From mmlr at mail.berlios.de Tue Jan 1 13:56:45 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Tue, 1 Jan 2008 13:56:45 +0100 Subject: [Haiku-commits] r23199 - haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata Message-ID: <200801011256.m01CujiP025345@sheep.berlios.de> Author: mmlr Date: 2008-01-01 13:56:45 +0100 (Tue, 01 Jan 2008) New Revision: 23199 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23199&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata/legacy_sata.c Log: Since r23142 the ide_adapter does not clear the PCI_address_space bit when detecting a channel. Drivers that use the ide_adapter therefore have to do that themselfs, which broke legacy_sata (probably this is also the case for the promise_tx2 driver). I investigated this as it broke my attempt of a it8211 driver too. This might fix bug #1683 but I cannot test that. Also cleaned out some space indent in that file. Modified: haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata/legacy_sata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata/legacy_sata.c 2007-12-30 13:31:45 UTC (rev 23198) +++ haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata/legacy_sata.c 2008-01-01 12:56:45 UTC (rev 23199) @@ -121,7 +121,7 @@ static status_t controller_probe(device_node_handle parent) { - device_node_handle controller_node; + device_node_handle controller_node; device_node_handle channels[4]; uint16 command_block_base[4]; uint16 control_block_base[4]; @@ -133,6 +133,7 @@ uint16 vendor_id; uint8 int_num; status_t res; + uint8 index; TRACE("controller_probe\n"); @@ -176,35 +177,40 @@ case ID(PCI_vendor_ALI, PCI_device_ALI5287): num_channels = 4; - command_block_base[2] = pci->read_pci_config(device, PCI_base_registers + 0, 4) + 8; - control_block_base[2] = pci->read_pci_config(device, PCI_base_registers + 4, 4) + 4; - command_block_base[3] = pci->read_pci_config(device, PCI_base_registers + 8, 4) + 8; - control_block_base[3] = pci->read_pci_config(device, PCI_base_registers + 12, 4) + 4; + command_block_base[2] = pci->read_pci_config(device, PCI_base_registers + 0, 4) + 8; + control_block_base[2] = pci->read_pci_config(device, PCI_base_registers + 4, 4) + 4; + command_block_base[3] = pci->read_pci_config(device, PCI_base_registers + 8, 4) + 8; + control_block_base[3] = pci->read_pci_config(device, PCI_base_registers + 12, 4) + 4; break; } - res = ide_adapter->detect_controller(pci, device, parent, bus_master_base, - CONTROLLER_MODULE_NAME, "" /* XXX: unused: controller_driver_type*/, CONTROLLER_NAME, true, - true, 1, 0xffff, 0x10000, &controller_node); - // don't register if controller is already registered! - // (happens during rescan; registering new channels would kick out old channels) - if (res != B_OK) + for (index = 0; index < num_channels; index++) { + command_block_base[index] &= ~PCI_address_space; + control_block_base[index] &= ~PCI_address_space; + } + + res = ide_adapter->detect_controller(pci, device, parent, bus_master_base, + CONTROLLER_MODULE_NAME, "" /* XXX: unused: controller_driver_type*/, CONTROLLER_NAME, true, + true, 1, 0xffff, 0x10000, &controller_node); + // don't register if controller is already registered! + // (happens during rescan; registering new channels would kick out old channels) + if (res != B_OK) goto err; if (controller_node == NULL) { res = B_IO_ERROR; - goto err; + goto err; } - // ignore errors during registration of channels - could be a simple rescan collision - res = ide_adapter->detect_channel(pci, device, controller_node, CHANNEL_MODULE_NAME, - true, command_block_base[0], control_block_base[0], bus_master_base, - int_num, true, "Primary Channel", &channels[0], false); + // ignore errors during registration of channels - could be a simple rescan collision + res = ide_adapter->detect_channel(pci, device, controller_node, CHANNEL_MODULE_NAME, + true, command_block_base[0], control_block_base[0], bus_master_base, + int_num, true, "Primary Channel", &channels[0], false); dprintf("Primary Channel: %s\n", strerror(res)); - res = ide_adapter->detect_channel(pci, device, controller_node, CHANNEL_MODULE_NAME, - true, command_block_base[1], control_block_base[1], bus_master_base, - int_num, false, "Secondary Channel", &channels[1], false); + res = ide_adapter->detect_channel(pci, device, controller_node, CHANNEL_MODULE_NAME, + true, command_block_base[1], control_block_base[1], bus_master_base, + int_num, false, "Secondary Channel", &channels[1], false); dprintf("Secondary Channel: %s\n", strerror(res)); From mmlr at mail.berlios.de Tue Jan 1 15:36:52 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Tue, 1 Jan 2008 15:36:52 +0100 Subject: [Haiku-commits] r23200 - haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata Message-ID: <200801011436.m01EaqtT032124@sheep.berlios.de> Author: mmlr Date: 2008-01-01 15:36:51 +0100 (Tue, 01 Jan 2008) New Revision: 23200 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23200&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata/legacy_sata.c Log: Also clear the pci_address_space bit from the bus_master_base. Again might help on bug #1683. Modified: haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata/legacy_sata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata/legacy_sata.c 2008-01-01 12:56:45 UTC (rev 23199) +++ haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata/legacy_sata.c 2008-01-01 14:36:51 UTC (rev 23200) @@ -184,6 +184,7 @@ break; } + bus_master_base &= ~PCI_address_space; for (index = 0; index < num_channels; index++) { command_block_base[index] &= ~PCI_address_space; control_block_base[index] &= ~PCI_address_space; From jackburton at mail.berlios.de Tue Jan 1 15:37:19 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 1 Jan 2008 15:37:19 +0100 Subject: [Haiku-commits] r23201 - haiku/trunk/src/kits/interface Message-ID: <200801011437.m01EbJPY032173@sheep.berlios.de> Author: jackburton Date: 2008-01-01 15:37:19 +0100 (Tue, 01 Jan 2008) New Revision: 23201 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23201&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp Log: Set sticky mode to the correct value before calling BMenu::_Track(). Fixes bug #1679 Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-01 14:36:51 UTC (rev 23200) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-01 14:37:19 UTC (rev 23201) @@ -1170,6 +1170,8 @@ UnlockLooper(); } + _SetStickyMode(sticky); + int action; BMenuItem *menuItem = _Track(&action); From jackburton at mail.berlios.de Tue Jan 1 15:42:27 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 1 Jan 2008 15:42:27 +0100 Subject: [Haiku-commits] r23202 - haiku/trunk/src/servers/input Message-ID: <200801011442.m01EgReo032560@sheep.berlios.de> Author: jackburton Date: 2008-01-01 15:42:27 +0100 (Tue, 01 Jan 2008) New Revision: 23202 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23202&view=rev Modified: haiku/trunk/src/servers/input/InputServerMethod.cpp Log: The parameter passed to BInputServerMethod:SetIcon() can be NULL. Patch by Anthony Lee. Thank you! Fixes bug #1686. Modified: haiku/trunk/src/servers/input/InputServerMethod.cpp =================================================================== --- haiku/trunk/src/servers/input/InputServerMethod.cpp 2008-01-01 14:37:19 UTC (rev 23201) +++ haiku/trunk/src/servers/input/InputServerMethod.cpp 2008-01-01 14:42:27 UTC (rev 23202) @@ -159,7 +159,10 @@ fMenu(NULL) { fName = strdup(name); - memcpy(fIcon, icon, 16*16*1); + if (icon != NULL) + memcpy(fIcon, icon, 16*16*1); + else + memset(fIcon, 0x1d, 16*16*1); } @@ -193,8 +196,12 @@ _BMethodAddOn_::SetIcon(const uchar* icon) { CALLED(); - memcpy(fIcon, icon, 16*16*1); + if (icon != NULL) + memcpy(fIcon, icon, 16*16*1); + else + memset(fIcon, 0x1d, 16*16*1); + BMessage msg(IS_UPDATE_ICON); msg.AddInt32("cookie", (uint32)fMethod); msg.AddData("icon", B_RAW_TYPE, icon, 16*16*1); From mmlr at mlotz.ch Tue Jan 1 16:07:27 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Tue, 01 Jan 2008 16:07:27 +0100 Subject: [Haiku-commits] r23177 - haiku/trunk/src/apps/aboutsystem In-Reply-To: <200712280005.lBS05SBV029993@sheep.berlios.de> Message-ID: <752210497-BeMail@primary> Hi Francois > New Revision: 23177 > Log: > Add a list of installed apps and their copyrights to the credits > view, using a query. I just tried this and took a look at the list. While I find the use of a query to do this quite cool and elegant, I somehow have concerns about having it where it is now. I would find it most suitable and useful in an installer/package manager style application. Putting it into AboutSystem with no filtering somehow looks to me as if 3rd party software was "endorsed" by Haiku even if there is no connection at all. On a plain installation it obviously only lists stuff actually brought in by Haiku which is not a problem. But on my system here where I put a lot of R5 stuff to test, the list somehow does not fit anymore. This is just my opinion though and I don't have strong feelings about it. So if everyone else has no such concerns it's a non-issue. Regards Michael From jackburton at mail.berlios.de Tue Jan 1 16:50:38 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 1 Jan 2008 16:50:38 +0100 Subject: [Haiku-commits] r23203 - haiku/trunk/src/kits/interface Message-ID: <200801011550.m01Foc4R002942@sheep.berlios.de> Author: jackburton Date: 2008-01-01 16:50:37 +0100 (Tue, 01 Jan 2008) New Revision: 23203 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23203&view=rev Modified: haiku/trunk/src/kits/interface/TextView.cpp Log: Removed SetViewCursor() from BTextView::_Deactivate(), as suggested by cl21. Modified: haiku/trunk/src/kits/interface/TextView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextView.cpp 2008-01-01 14:42:27 UTC (rev 23202) +++ haiku/trunk/src/kits/interface/TextView.cpp 2008-01-01 15:50:37 UTC (rev 23203) @@ -3541,81 +3541,82 @@ } // do we have any text to draw? - if (length > 0) { - bool foundTab = false; - int32 tabChars = 0; - int32 numTabs = 0; - int32 offset = startOffset != -1 ? startOffset : line->offset; - const BFont *font = NULL; - const rgb_color *color = NULL; - int32 numBytes; - // iterate through each style on this line - while ((numBytes = fStyles->Iterate(offset, length, fInline, &font, - &color)) != 0) { - view->SetFont(font); - view->SetHighColor(*color); + if (length <= 0) + return; - tabChars = numBytes; - do { - foundTab = fText->FindChar(B_TAB, offset, &tabChars); - if (foundTab) { - do { - numTabs++; - if (ByteAt(offset + tabChars + numTabs) != B_TAB) - break; - } while ((tabChars + numTabs) < numBytes); - } + bool foundTab = false; + int32 tabChars = 0; + int32 numTabs = 0; + int32 offset = startOffset != -1 ? startOffset : line->offset; + const BFont *font = NULL; + const rgb_color *color = NULL; + int32 numBytes; + // iterate through each style on this line + while ((numBytes = fStyles->Iterate(offset, length, fInline, &font, + &color)) != 0) { + view->SetFont(font); + view->SetHighColor(*color); - if (inputRegion.CountRects() > 0) { - BRegion textRegion; - GetTextRegion(offset, offset + length, &textRegion); + tabChars = numBytes; + do { + foundTab = fText->FindChar(B_TAB, offset, &tabChars); + if (foundTab) { + do { + numTabs++; + if (ByteAt(offset + tabChars + numTabs) != B_TAB) + break; + } while ((tabChars + numTabs) < numBytes); + } - textRegion.IntersectWith(&inputRegion); - view->PushState(); + if (inputRegion.CountRects() > 0) { + BRegion textRegion; + GetTextRegion(offset, offset + length, &textRegion); - // Highlight in blue the inputted text - view->SetHighColor(kBlueInputColor); - view->FillRect(textRegion.Frame()); + textRegion.IntersectWith(&inputRegion); + view->PushState(); - // Highlight in red the selected part - if (fInline->SelectionLength() > 0) { - BRegion selectedRegion; - GetTextRegion(fInline->Offset() - + fInline->SelectionOffset(), fInline->Offset() - + fInline->SelectionOffset() - + fInline->SelectionLength(), &selectedRegion); + // Highlight in blue the inputted text + view->SetHighColor(kBlueInputColor); + view->FillRect(textRegion.Frame()); - textRegion.IntersectWith(&selectedRegion); + // Highlight in red the selected part + if (fInline->SelectionLength() > 0) { + BRegion selectedRegion; + GetTextRegion(fInline->Offset() + + fInline->SelectionOffset(), fInline->Offset() + + fInline->SelectionOffset() + + fInline->SelectionLength(), &selectedRegion); - view->SetHighColor(kRedInputColor); - view->FillRect(textRegion.Frame()); - } + textRegion.IntersectWith(&selectedRegion); - view->PopState(); + view->SetHighColor(kRedInputColor); + view->FillRect(textRegion.Frame()); } - int32 returnedBytes = tabChars; - const char *stringToDraw = fText->GetString(offset, - &returnedBytes); + view->PopState(); + } - view->DrawString(stringToDraw, returnedBytes); - if (foundTab) { - float penPos = PenLocation().x - fTextRect.left; - float tabWidth = _ActualTabWidth(penPos); - if (numTabs > 1) - tabWidth += ((numTabs - 1) * fTabWidth); + int32 returnedBytes = tabChars; + const char *stringToDraw = fText->GetString(offset, + &returnedBytes); - view->MovePenBy(tabWidth, 0.0); - tabChars += numTabs; - } + view->DrawString(stringToDraw, returnedBytes); + if (foundTab) { + float penPos = PenLocation().x - fTextRect.left; + float tabWidth = _ActualTabWidth(penPos); + if (numTabs > 1) + tabWidth += ((numTabs - 1) * fTabWidth); - offset += tabChars; - length -= tabChars; - numBytes -= tabChars; - tabChars = numBytes; - numTabs = 0; - } while (foundTab && tabChars > 0); - } + view->MovePenBy(tabWidth, 0.0); + tabChars += numTabs; + } + + offset += tabChars; + length -= tabChars; + numBytes -= tabChars; + tabChars = numBytes; + numTabs = 0; + } while (foundTab && tabChars > 0); } } @@ -4191,12 +4192,6 @@ Highlight(fSelStart, fSelEnd); } else _HideCaret(); - - BPoint where; - ulong buttons; - GetMouse(&where, &buttons); - if (Bounds().Contains(where)) - SetViewCursor(B_CURSOR_SYSTEM_DEFAULT); } From jackburton at mail.berlios.de Tue Jan 1 16:54:29 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 1 Jan 2008 16:54:29 +0100 Subject: [Haiku-commits] r23204 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200801011554.m01FsTRd003097@sheep.berlios.de> Author: jackburton Date: 2008-01-01 16:54:28 +0100 (Tue, 01 Jan 2008) New Revision: 23204 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23204&view=rev Modified: haiku/trunk/headers/os/interface/PrintJob.h haiku/trunk/src/kits/interface/PrintJob.cpp Log: BPrintJob: PrintableRect(), PaperRect() and GetResolution() now call _LoadDefaultSettings() if no settings were loaded already, in order to return valid values. Renamed private methods to fit our guidelines. Modified: haiku/trunk/headers/os/interface/PrintJob.h =================================================================== --- haiku/trunk/headers/os/interface/PrintJob.h 2008-01-01 15:50:37 UTC (rev 23203) +++ haiku/trunk/headers/os/interface/PrintJob.h 2008-01-01 15:54:28 UTC (rev 23204) @@ -84,19 +84,19 @@ BPrintJob(const BPrintJob &); BPrintJob &operator=(const BPrintJob &); - void RecurseView(BView *v, BPoint origin, BPicture *p, BRect r); - void MangleName(char *filename); - void HandlePageSetup(BMessage *setup); - bool HandlePrintSetup(BMessage *setup); + void _RecurseView(BView *view, BPoint origin, BPicture *p, BRect r); + void _GetMangledName(char *buffer, size_t bufferSize) const; + void _HandlePageSetup(BMessage *setup); + bool _HandlePrintSetup(BMessage *setup); - void NewPage(); - void EndLastPage(); + void _NewPage(); + void _EndLastPage(); - void AddSetupSpec(); - void AddPicture(BPicture *picture, BRect *rect, BPoint where); + void _AddSetupSpec(); + void _AddPicture(BPicture &picture, BRect &rect, BPoint &where); - char* GetCurrentPrinterName() const; - void LoadDefaultSettings(); + char* _GetCurrentPrinterName() const; + void _LoadDefaultSettings(); char * fPrintJobName; int32 fPageNumber; Modified: haiku/trunk/src/kits/interface/PrintJob.cpp =================================================================== --- haiku/trunk/src/kits/interface/PrintJob.cpp 2008-01-01 15:50:37 UTC (rev 23203) +++ haiku/trunk/src/kits/interface/PrintJob.cpp 2008-01-01 15:54:28 UTC (rev 23204) @@ -251,19 +251,10 @@ { CancelJob(); - if (fPrintJobName != NULL) { - free(fPrintJobName); - fPrintJobName = NULL; - } - - delete fDefaultSetupMessage; - fDefaultSetupMessage = NULL; - + free(fPrintJobName); delete fSetupMessage; - fSetupMessage = NULL; - + delete fDefaultSetupMessage; delete fCurrentPageHeader; - fCurrentPageHeader = NULL; } @@ -307,7 +298,7 @@ return status; delete fSetupMessage; fSetupMessage = configuration.Result(); - HandlePageSetup(fSetupMessage); + _HandlePageSetup(fSetupMessage); return B_OK; } @@ -351,7 +342,7 @@ return status; delete fSetupMessage; fSetupMessage = configuration.Result(); - HandlePrintSetup(fSetupMessage); + _HandlePrintSetup(fSetupMessage); return B_OK; } @@ -378,7 +369,7 @@ if (status != B_OK) return; - char *printer = GetCurrentPrinterName(); + char *printer = _GetCurrentPrinterName(); if (printer == NULL) return; @@ -386,7 +377,7 @@ free(printer); char mangledName[B_FILE_NAME_LENGTH]; - MangleName(mangledName); + _GetMangledName(mangledName, B_FILE_NAME_LENGTH); path.Append(mangledName); @@ -415,7 +406,7 @@ // add printer settings message if (!fSetupMessage->HasString(PSRV_FIELD_CURRENT_PRINTER)) fSetupMessage->AddString(PSRV_FIELD_CURRENT_PRINTER, printer); - AddSetupSpec(); + _AddSetupSpec(); // prepare page header // number_of_pictures is updated in DrawView() @@ -449,7 +440,7 @@ } // update spool file - EndLastPage(); + _EndLastPage(); // set file attributes app_info appInfo; @@ -534,8 +525,8 @@ if (view->LockLooper()) { BPicture picture; - RecurseView(view, where, &picture, rect); - AddPicture(&picture, &rect, where); + _RecurseView(view, where, &picture, rect); + _AddPicture(picture, rect, where); view->UnlockLooper(); } } @@ -556,7 +547,7 @@ BPrintJob::SetSettings(BMessage *message) { if (message != NULL) { - HandlePrintSetup(message); + _HandlePrintSetup(message); } delete fSetupMessage; fSetupMessage = message; @@ -566,7 +557,7 @@ bool BPrintJob::IsSettingsMessageValid(BMessage *message) const { - char *printerName = GetCurrentPrinterName(); + char *printerName = _GetCurrentPrinterName(); if (printerName == NULL) { return false; } @@ -588,6 +579,8 @@ BRect BPrintJob::PaperRect() { + if (fDefaultSetupMessage == NULL) + _LoadDefaultSettings(); return fPaperSize; } @@ -595,6 +588,8 @@ BRect BPrintJob::PrintableRect() { + if (fDefaultSetupMessage == NULL) + _LoadDefaultSettings(); return fUsableSize; } @@ -602,12 +597,13 @@ void BPrintJob::GetResolution(int32 *xdpi, int32 *ydpi) { - if (xdpi != NULL) { + if (fDefaultSetupMessage == NULL) + _LoadDefaultSettings(); + + if (xdpi != NULL) *xdpi = fXResolution; - } - if (ydpi != NULL) { + if (ydpi != NULL) *ydpi = fYResolution; - } } @@ -652,7 +648,7 @@ void -BPrintJob::RecurseView(BView *view, BPoint origin, +BPrintJob::_RecurseView(BView *view, BPoint origin, BPicture *picture, BRect rect) { ASSERT(picture != NULL); @@ -671,24 +667,21 @@ while (child != NULL) { // TODO: origin and rect should probably // be converted for children views in some way - RecurseView(child, origin, picture, rect); + _RecurseView(child, origin, picture, rect); child = child->NextSibling(); } } void -BPrintJob::MangleName(char *filename) +BPrintJob::_GetMangledName(char *buffer, size_t bufferSize) const { - char sysTime[10]; - snprintf(sysTime, sizeof(sysTime), "@%lld", system_time() / 1000); - strncpy(filename, fPrintJobName, B_FILE_NAME_LENGTH - sizeof(sysTime)); - strcat(filename, sysTime); + snprintf(buffer, bufferSize, "%s@%lld", fPrintJobName, system_time() / 1000); } void -BPrintJob::HandlePageSetup(BMessage *setup) +BPrintJob::_HandlePageSetup(BMessage *setup) { setup->FindRect(PSRV_FIELD_PRINTABLE_RECT, &fUsableSize); setup->FindRect(PSRV_FIELD_PAPER_RECT, &fPaperSize); @@ -705,9 +698,9 @@ bool -BPrintJob::HandlePrintSetup(BMessage *message) +BPrintJob::_HandlePrintSetup(BMessage *message) { - HandlePageSetup(message); + _HandlePageSetup(message); bool valid = true; if (message->FindInt32(PSRV_FIELD_FIRST_PAGE, &fFirstPage) != B_OK) { @@ -722,7 +715,7 @@ void -BPrintJob::NewPage() +BPrintJob::_NewPage() { // write page header fCurrentPageHeaderOffset = fSpoolFile->Position(); @@ -736,7 +729,7 @@ void -BPrintJob::EndLastPage() +BPrintJob::_EndLastPage() { fSpoolFile->Seek(0, SEEK_SET); fCurrentHeader.page_count = fPageNumber; @@ -744,27 +737,25 @@ void -BPrintJob::AddSetupSpec() +BPrintJob::_AddSetupSpec() { fSetupMessage->Flatten(fSpoolFile); } void -BPrintJob::AddPicture(BPicture *picture, BRect *rect, BPoint where) +BPrintJob::_AddPicture(BPicture &picture, BRect &rect, BPoint &where) { - ASSERT(picture != NULL); ASSERT(fSpoolFile != NULL); - ASSERT(rect != NULL); if (fCurrentPageHeader->number_of_pictures == 0) { - NewPage(); + _NewPage(); } fCurrentPageHeader->number_of_pictures ++; fSpoolFile->Write(&where, sizeof(where)); - fSpoolFile->Write(rect, sizeof(*rect)); - picture->Flatten(fSpoolFile); + fSpoolFile->Write(&rect, sizeof(rect)); + picture.Flatten(fSpoolFile); } @@ -772,7 +763,7 @@ // or NULL if it ccould not be obtained. // Caller is responsible to free the string using free(). char * -BPrintJob::GetCurrentPrinterName() const +BPrintJob::_GetCurrentPrinterName() const { BMessenger printServer; if (GetPrinterServerMessenger(printServer)) { @@ -795,7 +786,7 @@ void -BPrintJob::LoadDefaultSettings() +BPrintJob::_LoadDefaultSettings() { BMessenger printServer; if (GetPrinterServerMessenger(printServer) != B_OK) { @@ -807,7 +798,7 @@ printServer.SendMessage(&message, reply); - HandlePrintSetup(reply); + _HandlePrintSetup(reply); delete fDefaultSetupMessage; fDefaultSetupMessage = reply; From mmu_man at mail.berlios.de Tue Jan 1 19:28:27 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 1 Jan 2008 19:28:27 +0100 Subject: [Haiku-commits] r23205 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801011828.m01ISRbS027805@sheep.berlios.de> Author: mmu_man Date: 2008-01-01 19:28:26 +0100 (Tue, 01 Jan 2008) New Revision: 23205 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23205&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile haiku/trunk/src/system/boot/platform/atari_m68k/bios.h haiku/trunk/src/system/boot/platform/atari_m68k/debug.c haiku/trunk/src/system/boot/platform/atari_m68k/gemdos.h haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.cpp haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.h haiku/trunk/src/system/boot/platform/atari_m68k/menu.cpp haiku/trunk/src/system/boot/platform/atari_m68k/xbios.h Log: Some atari boot code Added: haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-01 15:54:28 UTC (rev 23204) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-01 18:28:26 UTC (rev 23205) @@ -0,0 +1,53 @@ +SubDir HAIKU_TOP src system boot platform atari_m68k ; + +SubDirHdrs $(HAIKU_TOP) headers private kernel boot platform $(TARGET_BOOT_PLATFORM) ; + +UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; +UsePrivateHeaders [ FDirName graphics common ] ; +#UsePrivateHeaders [ FDirName graphics vesa ] ; +UsePrivateHeaders [ FDirName storage ] ; + +{ + local defines = _BOOT_MODE ; + + defines = [ FDefines $(defines) ] ; + SubDirCcFlags $(defines) -Wall -Wno-multichar ; + SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-rtti ; +} + +#SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; + +KernelMergeObject boot_platform_atari_m68k.o : + shell.S + start.c + debug.c + bios.S + console.cpp + serial.cpp + devices.cpp + keyboard.cpp + menu.cpp + mmu.cpp + cpu.cpp + smp.cpp + smp_trampoline.S + support.S + video.cpp + apm.cpp + + # generic + text_menu.cpp + + # VESA/DDC EDID + #decode_edid.c + #dump_edid.c + + : -fno-pic +; + +SEARCH on [ FGristFiles text_menu.cpp ] + = [ FDirName $(HAIKU_TOP) src system boot platform generic ] ; + +# Tell the build system to where stage1.bin can be found, so it can be used +# elsewhere. +SEARCH on stage1.bin = $(SUBDIR) ; Added: haiku/trunk/src/system/boot/platform/atari_m68k/bios.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/bios.h 2008-01-01 15:54:28 UTC (rev 23204) +++ haiku/trunk/src/system/boot/platform/atari_m68k/bios.h 2008-01-01 18:28:26 UTC (rev 23205) @@ -0,0 +1,42 @@ +/* + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT license. + * + * Author: + * Fran?ois Revol, revol at free.fr. + */ +#ifndef _BIOS_H +#define _BIOS_H + +/* + * Atari BIOS calls + */ + +#define BIOS_TRAP XXX + +// BIOSxxx...: x: param type {W|L} + +#define BIOS(nr) \ +({ uint32 ret; \ +asm volatile ( \ +" move #%0,-(sp)\n" \ +" trap #" #BIOS_TRAP "\n" \ +" add.l #2,sp" \ +:: "=r"(ret)); \ +ret; }) + +#define BIOSW(nr, w0) \ +({ uint32 ret; \ +asm volatile ( \ +" move.w %1,-(sp)\n" \ +" move #" #nr ",-(sp)\n" \ +" trap #" #BIOS_TRAP "\n" \ +" add.l #2,sp" \ +:: "=r"(ret)); \ +ret; }) + +#define Bconin(p0) (uint32)BIOSW(2, p0) +//XXX nparams ? +#define Kbshift(p0) (uint32)BIOSW(11, p0) + +#endif /* _BIOS_H */ Added: haiku/trunk/src/system/boot/platform/atari_m68k/debug.c =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/debug.c 2008-01-01 15:54:28 UTC (rev 23204) +++ haiku/trunk/src/system/boot/platform/atari_m68k/debug.c 2008-01-01 18:28:26 UTC (rev 23205) @@ -0,0 +1,54 @@ +/* + * Copyright 2004-2007, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include "serial.h" +#include "keyboard.h" + +#include +#include +#include + + +/*! This works only after console_init() was called. +*/ +void +panic(const char *format, ...) +{ + va_list list; + + platform_switch_to_text_mode(); + + puts("*** PANIC ***"); + + va_start(list, format); + vprintf(format, list); + va_end(list); + + puts("\nPress key to reboot."); + + clear_key_buffer(); + wait_for_key(); + platform_exit(); +} + + +void +dprintf(const char *format, ...) +{ + char buffer[512]; + va_list list; + int length; + + va_start(list, format); + length = vsnprintf(buffer, sizeof(buffer), format, list); + va_end(list); + + serial_puts(buffer, length); + + if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) + fprintf(stderr, "%s", buffer); +} + Added: haiku/trunk/src/system/boot/platform/atari_m68k/gemdos.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/gemdos.h 2008-01-01 15:54:28 UTC (rev 23204) +++ haiku/trunk/src/system/boot/platform/atari_m68k/gemdos.h 2008-01-01 18:28:26 UTC (rev 23205) @@ -0,0 +1,24 @@ +/* + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT license. + * + * Author: + * Fran?ois Revol, revol at free.fr. + */ +#ifndef _GEMDOS_H +#define _GEMDOS_H + +/* + * Atari GEMDOS calls + */ + +#define GEMDOS_TRAP 1 + +// official names +#define Cconin() GEMDOS(1) + +// check for names +#define supexec() GEMDOS(0x20) +#define terminate() GEMDOS(0) + +#endif /* _GEMDOS_H */ Added: haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.cpp 2008-01-01 15:54:28 UTC (rev 23204) +++ haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.cpp 2008-01-01 18:28:26 UTC (rev 23205) @@ -0,0 +1,78 @@ +/* +** Copyright 2004, Axel D?rfler, axeld at pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include "keyboard.h" +#include "bios.h" + +#include + + +static uint16 +check_for_key(void) +{ +//XXX: non blocking in ? +#if 0 + bios_regs regs; + regs.eax = 0x0100; + call_bios(0x16, ®s); + + // the zero flag is set when there is no key stroke waiting for us + if (regs.flags & ZERO_FLAG) + return 0; + + // remove the key from the buffer + regs.eax = 0; + call_bios(0x16, ®s); + + return regs.eax & 0xffff; +#endif + return 0; +} + + +extern "C" void +clear_key_buffer(void) +{ + while (check_for_key() != 0) + ; +} + + +extern "C" union key +wait_for_key(void) +{ + union key key; + key.d0 = Bconin(2); + + return key; +} + + +extern "C" uint32 +check_for_boot_keys(void) +{ + union key key; + uint32 options = 0; + + while ((key.ax = check_for_key()) != 0) { + switch (key.code.ascii) { + case ' ': + options |= BOOT_OPTION_MENU; + break; + case 0x1b: // escape + options |= BOOT_OPTION_DEBUG_OUTPUT; + break; + case 0: + // evaluate BIOS scan codes + // ... + break; + } + } + + dprintf("options = %ld\n", options); + return options; +} + Added: haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.h 2008-01-01 15:54:28 UTC (rev 23204) +++ haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.h 2008-01-01 18:28:26 UTC (rev 23205) @@ -0,0 +1,38 @@ +#ifndef KEYBOARD_H +#define KEYBOARD_H + + +#include + + +union key { + uint32 d0; + struct { + uint16 bios; // scan code + uint16 ascii; + } code; +}; + +#define BIOS_KEY_UP 0x48 +#define BIOS_KEY_DOWN 0x50 +#define BIOS_KEY_LEFT 0x4b +#define BIOS_KEY_RIGHT 0x4d +// XXX: FIXME +#define BIOS_KEY_HOME 0x47 +#define BIOS_KEY_END 0x4f +#define BIOS_KEY_PAGE_UP 0x49 +#define BIOS_KEY_PAGE_DOWN 0x51 + +#ifdef __cplusplus +extern "C" { +#endif + +extern void clear_key_buffer(void); +extern union key wait_for_key(void); +extern uint32 check_for_boot_keys(void); + +#ifdef __cplusplus +} +#endif + +#endif /* KEYBOARD_H */ Added: haiku/trunk/src/system/boot/platform/atari_m68k/menu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/menu.cpp 2008-01-01 15:54:28 UTC (rev 23204) +++ haiku/trunk/src/system/boot/platform/atari_m68k/menu.cpp 2008-01-01 18:28:26 UTC (rev 23205) @@ -0,0 +1,66 @@ +/* + * Copyright 2004-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include "smp.h" +#include "video.h" + +#include +#include +#include + + +void +platform_add_menus(Menu *menu) +{ + MenuItem *item; + + switch (menu->Type()) { + case MAIN_MENU: + menu->AddItem(item = new(nothrow) MenuItem("Select fail-safe video mode", video_mode_menu())); + item->SetTarget(video_mode_hook); + break; + case SAFE_MODE_MENU: + menu->AddItem(item = new(nothrow) MenuItem("Use fail-safe video mode")); + item->SetType(MENU_ITEM_MARKABLE); + item->SetData(B_SAFEMODE_FAIL_SAFE_VIDEO_MODE); + item->SetHelpText("The system will use VESA mode and won't try to open any video graphics driver"); + + smp_add_safemode_menus(menu); + +#if 0 + menu->AddItem(item = new(nothrow) MenuItem("Don't call the BIOS")); + item->SetType(MENU_ITEM_MARKABLE); + + menu->AddItem(item = new(nothrow) MenuItem("Disable APM")); + item->SetType(MENU_ITEM_MARKABLE); + item->SetData("disable_apm"); + item->SetHelpText("This overrides the APM setting in the kernel settings file"); + + menu->AddItem(item = new(nothrow) MenuItem("Disable ACPI")); + item->SetType(MENU_ITEM_MARKABLE); + item->SetData(B_SAFEMODE_DISABLE_ACPI); + item->SetHelpText("This overrides the ACPI setting in the kernel settings file"); +#endif + break; + default: + break; + } +} + + +void +platform_update_menu_item(Menu *menu, MenuItem *item) +{ + platform_generic_update_text_menu_item(menu, item); +} + + +void +platform_run_menu(Menu *menu) +{ + platform_generic_run_text_menu(menu); +} + Added: haiku/trunk/src/system/boot/platform/atari_m68k/xbios.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/xbios.h 2008-01-01 15:54:28 UTC (rev 23204) +++ haiku/trunk/src/system/boot/platform/atari_m68k/xbios.h 2008-01-01 18:28:26 UTC (rev 23205) @@ -0,0 +1,18 @@ +/* + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT license. + * + * Author: + * Fran?ois Revol, revol at free.fr. + */ +#ifndef _XBIOS_H +#define _XBIOS_H + +/* + * Atari XBIOS calls + */ + +#define BIOS_TRAP 14 +//#define GEMDOS_TRAP 1 + +#endif /* _XBIOS_H */ From mmu_man at mail.berlios.de Tue Jan 1 20:56:53 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 1 Jan 2008 20:56:53 +0100 Subject: [Haiku-commits] r23206 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801011956.m01JurHQ007184@sheep.berlios.de> Author: mmu_man Date: 2008-01-01 20:56:53 +0100 (Tue, 01 Jan 2008) New Revision: 23206 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23206&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.S haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Removed: haiku/trunk/src/system/boot/platform/atari_m68k/bios.h haiku/trunk/src/system/boot/platform/atari_m68k/gemdos.h haiku/trunk/src/system/boot/platform/atari_m68k/xbios.h Log: A single header should be enough for all TOS calls. Deleted: haiku/trunk/src/system/boot/platform/atari_m68k/bios.h Deleted: haiku/trunk/src/system/boot/platform/atari_m68k/gemdos.h Added: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.S 2008-01-01 18:28:26 UTC (rev 23205) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.S 2008-01-01 19:56:53 UTC (rev 23206) @@ -0,0 +1,46 @@ +/* + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT license. + * + * Author: + * Fran?ois Revol, revol at free.fr. + */ + +#define FUNCTION(x) .global x; .type x, at function; x + +/* non reentrant but that's enough + * idea taken from + * http://www.fortunecity.com/skyscraper/apple/308/html/chap4.htm + */ + +_trap_ret_addr: + .long 0 + +/* uint32 bios(uint16 nr, ...); */ +FUNCTION(bios): + move.l (%a7)+,_trap_ret_addr + trap # + move.l _trap_ret_addr,-(%a7) + rts + +/* uint32 xbios(uint16 nr, ...); */ +FUNCTION(xbios): + move.l (%a7)+,_trap_ret_addr + trap #14 + move.l _trap_ret_addr,-(%a7) + rts + +/* uint32 gemdos(uint16 nr, ...); */ +FUNCTION(gemdos): + move.l (%a7)+,_trap_ret_addr + trap #1 + move.l _trap_ret_addr,-(%a7) + rts + +/* uint32 vdi(uint16 nr, ...); */ +FUNCTION(vdi): + move.l (%a7)+,_trap_ret_addr + trap #14 + move.l _trap_ret_addr,-(%a7) + rts + Added: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-01 18:28:26 UTC (rev 23205) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-01 19:56:53 UTC (rev 23206) @@ -0,0 +1,50 @@ +/* + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT license. + * + * Author: + * Fran?ois Revol, revol at free.fr. + */ + +#ifndef _TOSCALLS_H +#define _TOSCALLS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Atari BIOS calls + */ + +extern uint32 bios(uint16 nr, ...); + +#define Bconin(p0) bios(2, p0) +//XXX nparams ? +#define Kbshift(p0) bios(11, p0) + +/* + * Atari XBIOS calls + */ + +extern uint32 bios(uint16 nr, ...); + + +/* + * Atari GEMDOS calls + */ + +extern uint32 gemdos(uint16 nr, ...); + +// official names +#define Cconin() gemdos(1) +#define Super(a) gemdos(0x20, (uint32)a) + +// check for names +#define terminate() GEMDOS(0) + +#ifdef __cplusplus +} +#endif + +#endif /* _TOSCALLS_H */ Deleted: haiku/trunk/src/system/boot/platform/atari_m68k/xbios.h From marcusoverhagen at mail.berlios.de Tue Jan 1 21:31:15 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Tue, 1 Jan 2008 21:31:15 +0100 Subject: [Haiku-commits] r23207 - in haiku/trunk: headers/build/os/drivers/bus/ide headers/private/drivers src/add-ons/kernel/busses/ide/legacy_sata src/add-ons/kernel/busses/ide/promise_tx2 src/add-ons/kernel/generic/ide_adapter Message-ID: <200801012031.m01KVFYZ009776@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-01 21:31:14 +0100 (Tue, 01 Jan 2008) New Revision: 23207 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23207&view=rev Modified: haiku/trunk/headers/build/os/drivers/bus/ide/ide_adapter.h haiku/trunk/headers/private/drivers/ide_adapter.h haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata/legacy_sata.c haiku/trunk/src/add-ons/kernel/busses/ide/promise_tx2/promise_tx2.c haiku/trunk/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c Log: Mask io-space bit in promise_tx2 driver, the driver was broken after recent ide-adapter changes. Replaced IDE_ADAPTER_IS_PRIMARY by IDE_ADAPTER_CHANNEL_INDEX to support more than 2 bus master channels, and made ide_adapter aware of 3rd and 4th channel when calculating bus master dma address. Fixed bus master DMA support in legacy_sata driver for tertiary and quaternary channel, channel 3 and 4 were using the DMA engine of primary and secondary channels (that might have destroyed your data). Use PCI_address_io_mask instead of ~PCI_address_space (no functional change). Modified: haiku/trunk/headers/build/os/drivers/bus/ide/ide_adapter.h =================================================================== --- haiku/trunk/headers/build/os/drivers/bus/ide/ide_adapter.h 2008-01-01 19:56:53 UTC (rev 23206) +++ haiku/trunk/headers/build/os/drivers/bus/ide/ide_adapter.h 2008-01-01 20:31:14 UTC (rev 23207) @@ -93,8 +93,8 @@ // interrupt number (uint8) // can also be defined in controller node if both channels use same IRQ! #define IDE_ADAPTER_INTNUM "ide_adapter/irq" -// non-zero if primary channel, else secondary channel (uint8) -#define IDE_ADAPTER_IS_PRIMARY "ide_adapter/is_primary" +// 0 if primary channel, 1 if secondary channel, 2 if tertiary, ... (uint8) +#define IDE_ADAPTER_CHANNEL_INDEX "ide_adapter/channel_index" // controller node items @@ -177,14 +177,14 @@ status_t (*publish_channel)(device_node_handle controller_node, const char *channel_module_name, uint16 command_block_base, uint16 control_block_base, uint8 intnum, bool can_dma, - bool is_primary, const char *name, + uint8 channel_index, const char *name, io_resource_handle *resources, device_node_handle *node); // verify channel configuration and publish node on success status_t (*detect_channel)(pci_device_module_info *pci, pci_device pci_device, device_node_handle controller_node, const char *channel_module_name, bool controller_can_dma, uint16 command_block_base, uint16 control_block_base, uint16 bus_master_base, - uint8 intnum, bool is_primary, const char *name, + uint8 intnum, uint8 channel_index, const char *name, device_node_handle *node, bool supports_compatibility_mode); // functions that must be called by init/uninit etc. of controller driver Modified: haiku/trunk/headers/private/drivers/ide_adapter.h =================================================================== --- haiku/trunk/headers/private/drivers/ide_adapter.h 2008-01-01 19:56:53 UTC (rev 23206) +++ haiku/trunk/headers/private/drivers/ide_adapter.h 2008-01-01 20:31:14 UTC (rev 23207) @@ -80,10 +80,9 @@ // interrupt number (uint8) // can also be defined in controller node if both channels use same IRQ! #define IDE_ADAPTER_INTNUM "ide_adapter/irq" -// non-zero if primary channel, else secondary channel (uint8) -#define IDE_ADAPTER_IS_PRIMARY "ide_adapter/is_primary" +// 0 if primary channel, 1 if secondary channel, 2 if tertiary, ... (uint8) +#define IDE_ADAPTER_CHANNEL_INDEX "ide_adapter/channel_index" - // controller node items // io address of bus master registers (uint16) #define IDE_ADAPTER_BUS_MASTER_BASE "ide_adapter/bus_master_base" @@ -164,14 +163,14 @@ status_t (*publish_channel)(device_node_handle controller_node, const char *channel_module_name, uint16 command_block_base, uint16 control_block_base, uint8 intnum, bool can_dma, - bool is_primary, const char *name, + uint8 channel_index, const char *name, io_resource_handle *resources, device_node_handle *node); // verify channel configuration and publish node on success status_t (*detect_channel)(pci_device_module_info *pci, pci_device pci_device, device_node_handle controller_node, const char *channel_module_name, bool controller_can_dma, uint16 command_block_base, uint16 control_block_base, uint16 bus_master_base, - uint8 intnum, bool is_primary, const char *name, + uint8 intnum, uint8 channel_index, const char *name, device_node_handle *node, bool supports_compatibility_mode); // functions that must be called by init/uninit etc. of controller driver Modified: haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata/legacy_sata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata/legacy_sata.c 2008-01-01 19:56:53 UTC (rev 23206) +++ haiku/trunk/src/add-ons/kernel/busses/ide/legacy_sata/legacy_sata.c 2008-01-01 20:31:14 UTC (rev 23207) @@ -51,6 +51,11 @@ /* XXX: To be moved to PCI.h */ #define PCI_command_interrupt 0x400 +static const char * const kChannelNames[] = { + "Primary Channel", "Secondary Channel", + "Tertiary Channel", "Quaternary Channel" +}; + static ide_for_controller_interface* ide; static ide_adapter_interface* ide_adapter; static device_manager_info* dm; @@ -184,10 +189,10 @@ break; } - bus_master_base &= ~PCI_address_space; + bus_master_base &= PCI_address_io_mask; for (index = 0; index < num_channels; index++) { - command_block_base[index] &= ~PCI_address_space; - control_block_base[index] &= ~PCI_address_space; + command_block_base[index] &= PCI_address_io_mask; + control_block_base[index] &= PCI_address_io_mask; } res = ide_adapter->detect_controller(pci, device, parent, bus_master_base, @@ -203,32 +208,16 @@ } // ignore errors during registration of channels - could be a simple rescan collision - res = ide_adapter->detect_channel(pci, device, controller_node, CHANNEL_MODULE_NAME, - true, command_block_base[0], control_block_base[0], bus_master_base, - int_num, true, "Primary Channel", &channels[0], false); - dprintf("Primary Channel: %s\n", strerror(res)); - - res = ide_adapter->detect_channel(pci, device, controller_node, CHANNEL_MODULE_NAME, - true, command_block_base[1], control_block_base[1], bus_master_base, - int_num, false, "Secondary Channel", &channels[1], false); - - dprintf("Secondary Channel: %s\n", strerror(res)); - - if (num_channels == 4) { + for (index = 0; index < num_channels; index++) { res = ide_adapter->detect_channel(pci, device, controller_node, CHANNEL_MODULE_NAME, - true, command_block_base[2], control_block_base[2], bus_master_base, - int_num, true, "Tertiary Channel", &channels[2], false); + true, command_block_base[index], control_block_base[index], bus_master_base, + int_num, index, kChannelNames[index], &channels[index], false); - dprintf("Tertiary Channel: %s\n", strerror(res)); - - res = ide_adapter->detect_channel(pci, device, controller_node, CHANNEL_MODULE_NAME, - true, command_block_base[3], control_block_base[3], bus_master_base, - int_num, false, "Quaternary Channel", &channels[3], false); - - dprintf("Quaternary Channel: %s\n", strerror(res)); + dprintf("%s: %s\n", kChannelNames[index], strerror(res)); } + dm->uninit_driver(parent); TRACE("controller_probe success\n"); Modified: haiku/trunk/src/add-ons/kernel/busses/ide/promise_tx2/promise_tx2.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ide/promise_tx2/promise_tx2.c 2008-01-01 19:56:53 UTC (rev 23206) +++ haiku/trunk/src/add-ons/kernel/busses/ide/promise_tx2/promise_tx2.c 2008-01-01 20:31:14 UTC (rev 23207) @@ -274,19 +274,25 @@ bus_master_base = pci->read_pci_config(device, PCI_base_registers + 16, 4); intnum = pci->read_pci_config(device, PCI_interrupt_line, 1); + command_block_base[0] &= PCI_address_io_mask; + control_block_base[0] &= PCI_address_io_mask; + command_block_base[1] &= PCI_address_io_mask; + control_block_base[1] &= PCI_address_io_mask; + bus_master_base &= PCI_address_io_mask; + res = detect_controller(pci, device, parent, bus_master_base, intnum, &controller_node); if (res != B_OK || controller_node == NULL) goto err; ide_adapter->detect_channel(pci, device, controller_node, PROMISE_TX2_CHANNEL_MODULE_NAME, true, - command_block_base[0], control_block_base[0], bus_master_base, intnum, true, - "Primary Channel", &channels[0], false); + command_block_base[0], control_block_base[0], bus_master_base, intnum, + 0, "Primary Channel", &channels[0], false); ide_adapter->detect_channel(pci, device, controller_node, PROMISE_TX2_CHANNEL_MODULE_NAME, true, - command_block_base[1], control_block_base[1], bus_master_base, intnum, false, - "Secondary Channel", &channels[1], false); + command_block_base[1], control_block_base[1], bus_master_base, intnum, + 1, "Secondary Channel", &channels[1], false); pnp->uninit_driver(parent); Modified: haiku/trunk/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c =================================================================== --- haiku/trunk/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c 2008-01-01 19:56:53 UTC (rev 23206) +++ haiku/trunk/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c 2008-01-01 20:31:14 UTC (rev 23207) @@ -329,7 +329,7 @@ uint8 intnum; int prdt_size; physical_entry pe[1]; - uint8 is_primary; + uint8 channel_index; status_t res; TRACE("PCI-IDE: init channel...\n"); @@ -338,7 +338,7 @@ if (pnp->get_attr_uint16(node, IDE_ADAPTER_COMMAND_BLOCK_BASE, &command_block_base, false) != B_OK || pnp->get_attr_uint16(node, IDE_ADAPTER_CONTROL_BLOCK_BASE, &control_block_base, false) != B_OK || pnp->get_attr_uint8(node, IDE_ADAPTER_INTNUM, &intnum, true) != B_OK - || pnp->get_attr_uint8(node, IDE_ADAPTER_IS_PRIMARY, &is_primary, false) != B_OK) + || pnp->get_attr_uint8(node, IDE_ADAPTER_CHANNEL_INDEX, &channel_index, false) != B_OK) return B_ERROR; if (pnp->init_driver(pnp->get_parent(node), NULL, NULL, (void **)&controller) != B_OK) @@ -356,12 +356,14 @@ channel->lost = false; channel->command_block_base = command_block_base; channel->control_block_base = control_block_base; - channel->bus_master_base = controller->bus_master_base + (is_primary ? 0 : 8); + channel->bus_master_base = controller->bus_master_base + (channel_index * 8); channel->intnum = intnum; channel->ide_channel = ide_channel; channel->dmaing = false; channel->inthand = inthand; + TRACE("PCI-IDE: bus master base %#x\n", channel->bus_master_base); + // PRDT must be contiguous, dword-aligned and must not cross 64K boundary prdt_size = (IDE_ADAPTER_MAX_SG_COUNT * sizeof( prd_entry ) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1); channel->prd_area = create_area("prd", (void **)&channel->prdt, B_ANY_KERNEL_ADDRESS, @@ -442,7 +444,7 @@ ide_adapter_publish_channel(device_node_handle controller_node, const char *channel_module_name, uint16 command_block_base, uint16 control_block_base, uint8 intnum, bool can_dma, - bool is_primary, const char *name, io_resource_handle *resources, + uint8 channel_index, const char *name, io_resource_handle *resources, device_node_handle *node) { device_attr attrs[] = { @@ -457,7 +459,7 @@ { 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_IS_PRIMARY, B_UINT8_TYPE, { ui8: is_primary }}, + { IDE_ADAPTER_CHANNEL_INDEX, B_UINT8_TYPE, { ui8: channel_index }}, { NULL } }; @@ -473,7 +475,7 @@ ide_adapter_detect_channel(pci_device_module_info *pci, pci_device pci_device, device_node_handle controller_node, const char *channel_module_name, bool controller_can_dma, uint16 command_block_base, uint16 control_block_base, - uint16 bus_master_base, uint8 intnum, bool is_primary, const char *name, + uint16 bus_master_base, uint8 intnum, uint8 channel_index, const char *name, device_node_handle *node, bool supports_compatibility_mode) { uint8 api; @@ -485,14 +487,14 @@ api = pci->read_pci_config(pci_device, PCI_class_api, 1); if (supports_compatibility_mode - && is_primary && (api & IDE_API_PRIMARY_NATIVE) == 0) { + && channel_index == 0 && (api & IDE_API_PRIMARY_NATIVE) == 0) { command_block_base = 0x1f0; control_block_base = 0x3f6; intnum = 14; TRACE("PCI-IDE: Controller in legacy mode: cmd %#x, ctrl %#x, irq %d\n", command_block_base, control_block_base, intnum); } else if (supports_compatibility_mode - && !is_primary && (api & IDE_API_PRIMARY_NATIVE) == 0) { + && channel_index == 1 && (api & IDE_API_PRIMARY_NATIVE) == 0) { command_block_base = 0x170; control_block_base = 0x376; intnum = 15; @@ -521,7 +523,7 @@ uint8 status = pci->read_io_8(pci_device, bus_master_base + IDE_BM_STATUS_REG); - if (status & IDE_BM_STATUS_SIMPLEX_DMA && !is_primary) { + if (status & IDE_BM_STATUS_SIMPLEX_DMA && channel_index != 0) { // in simplex mode, channels cannot operate independantly of each other; // we simply disable bus mastering of second channel to satisfy that; // better were to use a controller lock, but this had to be done in the IDE @@ -532,10 +534,6 @@ } } - bus_master_base += is_primary ? 0 : 8; - - TRACE("PCI-IDE: bus master base %#x\n", bus_master_base); - { // allocate channel's I/O resources io_resource resources[3] = { @@ -553,7 +551,7 @@ return ide_adapter_publish_channel(controller_node, channel_module_name, command_block_base, control_block_base, intnum, controller_can_dma, - is_primary, name, resource_handles, node); + channel_index, name, resource_handles, node); } @@ -738,11 +736,11 @@ bus_master_base = pci->read_pci_config(device, PCI_base_registers + 16, 4); intnum = pci->read_pci_config(device, PCI_interrupt_line, 1); - command_block_base[0] &= ~PCI_address_space; - control_block_base[0] &= ~PCI_address_space; - command_block_base[1] &= ~PCI_address_space; - control_block_base[1] &= ~PCI_address_space; - bus_master_base &= ~PCI_address_space; + command_block_base[0] &= PCI_address_io_mask; + control_block_base[0] &= PCI_address_io_mask; + command_block_base[1] &= PCI_address_io_mask; + control_block_base[1] &= PCI_address_io_mask; + bus_master_base &= PCI_address_io_mask; res = ide_adapter_detect_controller(pci, device, parent, bus_master_base, controller_driver, controller_driver_type, controller_name, can_dma, @@ -755,11 +753,11 @@ // ignore errors during registration of channels - could be a simple rescan collision ide_adapter_detect_channel(pci, device, controller_node, channel_module_name, can_dma, command_block_base[0], control_block_base[0], bus_master_base, - intnum, true, "Primary Channel", &channels[0], supports_compatibility_mode); + intnum, 0, "Primary Channel", &channels[0], supports_compatibility_mode); ide_adapter_detect_channel(pci, device, controller_node, channel_module_name, can_dma, command_block_base[1], control_block_base[1], bus_master_base, - intnum, false, "Secondary Channel", &channels[1], supports_compatibility_mode); + intnum, 1, "Secondary Channel", &channels[1], supports_compatibility_mode); pnp->uninit_driver(parent); From mmu_man at mail.berlios.de Tue Jan 1 21:41:19 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 1 Jan 2008 21:41:19 +0100 Subject: [Haiku-commits] r23208 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801012041.m01KfJ4c010198@sheep.berlios.de> Author: mmu_man Date: 2008-01-01 21:41:19 +0100 (Tue, 01 Jan 2008) New Revision: 23208 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23208&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/debug.c haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: TOS calls return a negative code on error. Map those to native errors. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/debug.c =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/debug.c 2008-01-01 20:31:14 UTC (rev 23207) +++ haiku/trunk/src/system/boot/platform/atari_m68k/debug.c 2008-01-01 20:41:19 UTC (rev 23208) @@ -6,11 +6,13 @@ #include "serial.h" #include "keyboard.h" +#include "toscalls.h" #include #include #include +#include /*! This works only after console_init() was called. */ @@ -52,3 +54,91 @@ fprintf(stderr, "%s", buffer); } + +/*! Maps TOS error codes to native errors + */ +status_t toserror(int32 err) +{ + // generated from: + // http://www.fortunecity.com/skyscraper/apple/308/html/appendd.htm + // with: + // while read N; do read V; read L; echo -e "\tcase $V: /* $N - $L */\n\t\treturn EINVAL;"; done >> errs + switch (err) { + /* BIOS errors */ + case 0: /* E_OK - No error */ + return B_OK; + case -1: /* ERROR - Generic error */ + return B_ERROR; + case -2: /* EDRVNR - Drive not ready */ + return B_DEV_NOT_READY; + case -3: /* EUNCMD - Unknown command */ + return EINVAL; //XXX + case -4: /* E_CRC - CRC error */ + return B_DEV_CRC_ERROR; + case -5: /* EBADRQ - Bad request */ + return EINVAL; //XXX + case -6: /* E_SEEK - Seek error */ + return B_DEV_SEEK_ERROR; + case -7: /* EMEDIA - Unknown media */ + return B_DEV_UNREADABLE; + case -8: /* ESECNF - Sector not found */ + return B_DEV_FORMAT_ERROR; + case -9: /* EPAPER - Out of paper */ + return ENODEV; + case -10: /* EWRITF - Write fault */ + return B_DEV_WRITE_ERROR; + case -11: /* EREADF - Read fault */ + return B_DEV_READ_ERROR; + case -12: /* EWRPRO - Device is write protected */ + return B_READ_ONLY_DEVICE; + case -14: /* E_CHNG - Media change detected */ + return B_DEV_MEDIA_CHANGED; + case -15: /* EUNDEV - Unknown device */ + return B_DEV_BAD_DRIVE_NUM; + case -16: /* EBADSF - Bad sectors on format */ + return B_DEV_UNREADABLE; + case -17: /* EOTHER - Insert other disk (request) */ + return B_DEV_MEDIA_CHANGE_REQUESTED; + /* GEMDOS errors */ + case -32: /* EINVFN - Invalid function */ + return EINVAL; + case -33: /* EFILNF - File not found */ + return B_FILE_NOT_FOUND; + case -34: /* EPTHNF - Path not found */ + return B_ENTRY_NOT_FOUND; + case -35: /* ENHNDL - No more handles */ + return B_NO_MORE_FDS; + case -36: /* EACCDN - Access denied */ + return EACCES; + case -37: /* EIHNDL - Invalid handle */ + return EBADF; + case -39: /* ENSMEM - Insufficient memory */ + return ENOMEM; + case -40: /* EIMBA - Invalid memory block address */ + return EFAULT; + case -46: /* EDRIVE - Invalid drive specification */ + return B_DEV_BAD_DRIVE_NUM; + case -48: /* ENSAME - Cross device rename */ + return EXDEV; + case -49: /* ENMFIL - No more files */ + return EMFILE; + case -58: /* ELOCKED - Record is already locked */ + return EINVAL; //XXX + case -59: /* ENSLOCK - Invalid lock removal request */ + return EINVAL; //XXX + case -64: /* ERANGE or ENAMETOOLONG - Range error */ + return ENAMETOOLONG; + case -65: /* EINTRN - Internal error */ + return B_ERROR; + case -66: /* EPLFMT - Invalid program load format */ + return ENOEXEC; + case -67: /* EGSBF - Memory block growth failure */ + return EINVAL; + case -80: /* ELOOP - Too many symbolic links */ + return ELOOP; + case -200: /* EMOUNT - Mount point crossed (indicator) */ + return EINVAL; + default: + return B_ERROR; + } +} Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-01 20:31:14 UTC (rev 23207) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-01 20:41:19 UTC (rev 23208) @@ -17,7 +17,7 @@ * Atari BIOS calls */ -extern uint32 bios(uint16 nr, ...); +extern int32 bios(uint16 nr, ...); #define Bconin(p0) bios(2, p0) //XXX nparams ? @@ -27,14 +27,15 @@ * Atari XBIOS calls */ -extern uint32 bios(uint16 nr, ...); +extern int32 bios(uint16 nr, ...); + /* * Atari GEMDOS calls */ -extern uint32 gemdos(uint16 nr, ...); +extern int32 gemdos(uint16 nr, ...); // official names #define Cconin() gemdos(1) @@ -43,6 +44,13 @@ // check for names #define terminate() GEMDOS(0) +/* + * error mapping + * in debug.c + */ + +extern status_t toserror(int32 err); + #ifdef __cplusplus } #endif From marcusoverhagen at mail.berlios.de Tue Jan 1 21:45:29 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Tue, 1 Jan 2008 21:45:29 +0100 Subject: [Haiku-commits] r23209 - haiku/trunk/src/add-ons/kernel/bus_managers/ide Message-ID: <200801012045.m01KjTmD010502@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-01 21:45:29 +0100 (Tue, 01 Jan 2008) New Revision: 23209 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23209&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ide/devices.c Log: Added debug info at the place that seems to deadlock in SMP systems with > 2 CPUs Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ide/devices.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ide/devices.c 2008-01-01 20:41:19 UTC (rev 23208) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ide/devices.c 2008-01-01 20:45:29 UTC (rev 23209) @@ -216,6 +216,7 @@ // do a short wait first - if there's no device at all we could wait forever // ToDo: have a look at this; if it times out (when the time is too short), // the kernel seems to crash a little later)! + TRACE("scan_device_int: waiting 100ms...\n"); if (acquire_sem_etc(bus->sync_wait_sem, 1, B_RELATIVE_TIMEOUT, 100000) == B_TIMED_OUT) { bool cont; @@ -248,6 +249,7 @@ // there is something, so wait for it acquire_sem(bus->sync_wait_sem); } + TRACE("scan_device_int: got a fast response\n"); // cancel the timeout manually; usually this is done by wait_for_sync(), but // we've used the wait semaphore directly From axeld at pinc-software.de Tue Jan 1 22:24:47 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 01 Jan 2008 22:24:47 +0100 CET Subject: [Haiku-commits] r23202 - haiku/trunk/src/servers/input In-Reply-To: <200801011442.m01EgReo032560@sheep.berlios.de> Message-ID: <2458683784-BeMail@zon> jackburton at BerliOS wrote: > + else > + memset(fIcon, 0x1d, 16*16*1); Is that by any chance B_TRANSPARENT_8_BIT? If so, I would prefer to use the constant instead. Bye, Axel. From axeld at pinc-software.de Tue Jan 1 22:34:22 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 01 Jan 2008 22:34:22 +0100 CET Subject: [Haiku-commits] r23177 - haiku/trunk/src/apps/aboutsystem In-Reply-To: <752210497-BeMail@primary> Message-ID: <3033861406-BeMail@zon> "Michael Lotz" wrote: > > New Revision: 23177 > > Log: > > Add a list of installed apps and their copyrights to the credits > > view, using a query. > I just tried this and took a look at the list. While I find the use > of > a query to do this quite cool and elegant, I somehow have concerns > about having it where it is now. I would find it most suitable and > useful in an installer/package manager style application. Putting it > into AboutSystem with no filtering somehow looks to me as if 3rd > party > software was "endorsed" by Haiku even if there is no connection at > all. > On a plain installation it obviously only lists stuff actually > brought > in by Haiku which is not a problem. But on my system here where I put > a > lot of R5 stuff to test, the list somehow does not fit anymore. This > is > just my opinion though and I don't have strong feelings about it. So > if > everyone else has no such concerns it's a non-issue. Same here, I just wanted to have a look at it before I speak up (still didn't find the time yet). Bye, Axel. From mmu_man at mail.berlios.de Tue Jan 1 23:52:03 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 1 Jan 2008 23:52:03 +0100 Subject: [Haiku-commits] r23210 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801012252.m01Mq3gR015979@sheep.berlios.de> Author: mmu_man Date: 2008-01-01 23:52:03 +0100 (Tue, 01 Jan 2008) New Revision: 23210 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23210&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.S haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: Hopefully enough relevant TOS hooks. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.S 2008-01-01 20:45:29 UTC (rev 23209) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.S 2008-01-01 22:52:03 UTC (rev 23210) @@ -19,7 +19,7 @@ /* uint32 bios(uint16 nr, ...); */ FUNCTION(bios): move.l (%a7)+,_trap_ret_addr - trap # + trap #13 move.l _trap_ret_addr,-(%a7) rts Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-01 20:45:29 UTC (rev 23209) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-01 22:52:03 UTC (rev 23210) @@ -13,24 +13,98 @@ extern "C" { #endif +#define DEV_PRINTER 0 +#define DEV_AUX 1 +#define DEV_CON 2 +#define DEV_MIDI 3 +#define DEV_IKBD 4 +#define DEV_RAW 5 + /* * Atari BIOS calls */ extern int32 bios(uint16 nr, ...); -#define Bconin(p0) bios(2, p0) -//XXX nparams ? -#define Kbshift(p0) bios(11, p0) +// cf. http://www.fortunecity.com/skyscraper/apple/308/html/bios.htm +struct tosbpb { + int16 recsiz; + int16 clsiz; + int16 clsizb; + int16 rdlen; + int16 fsiz; + int16 fatrec; + int16 datrec; + int16 numcl; + int16 bflags; +}; + +#define K_RSHIFT 0x01 +#define K_LSHIFT 0x02 +#define K_CTRL 0x04 +#define K_ALT 0x08 +#define K_CAPSLOCK 0x10 +#define K_CLRHOME 0x20 +#define K_INSERT 0x40 + +#define RW_READ 0x00 +#define RW_READ 0x01 +#define RW_NOMEDIACH 0x02 +#define RW_NORETRY 0x04 +#define RW_NOTRANSLATE 0x08 + +//#define Getmpb() bios(0) +#define Bconstat(dev) bios(1, (uint16)dev) +#define Bconin(dev) bios(2, (uint16)dev) +#define Bconout(dev, chr) bios(3, (uint16)dev, (uint16)chr) +#define Rwabs(mode, buf, count, recno, dev, lrecno) bios(4, (int16)mode, (void *)buf, (int16)count, (int16)recno, (uint16)dev, (int32)lrecno) +//#define Setexc() bios(5, ) +#define Tickcal() bios(6) +#define Getbpb(dev) (struct tosbpb *)bios(7, (uint16)dev) +#define Bcostat(dev) bios(8, (uint16)dev) +//#define Mediach() bios(9, ) +#define Drvmap() (uint32)bios(10) +#define Kbshift(mode) bios(11, (uint16)mode) + /* * Atari XBIOS calls */ -extern int32 bios(uint16 nr, ...); +extern int32 xbios(uint16 nr, ...); +#define IM_DISABLE 0 +#define IM_RELATIVE 1 +#define IM_ABSOLUTE 2 +#define IM_KEYCODE 4 +#define NVM_READ 0 +#define NVM_WRITE 1 +#define NVM_RESET 2 +#define Initmous(mode, param, vec) xbios(0, (int16)mode, (void *)param, (void *)vec) +#define Physbase() (void *)xbios(2) +#define Logbase() (void *)xbios(3) +//#define Getrez() xbios(4) +#define Setscreen(log, phys, mode) xbios(5, (void *)log, (void *)phys, (int16)mode) +#define VsetScreen(log, phys, mode, modecode) xbios(5, (void *)log, (void *)phys, (int16)mode) +//#define Mfpint() xbios(13, ) +#define Rsconf(speed, flow, ucr, rsr, tsr, scr) xbios(15, (int16)speed, (int16)flow, (int16)ucr, (int16)rsr, (int16)tsr, (int16)scr) +//#define Keytbl(unshift, shift, caps) (KEYTAB *)xbios(16, (char *)unshift, (char *)shift, (char *)caps) +#define Random() xbios(17) +#define Gettime() (uint32)xbios(23) +#define Jdisint(intno) xbios(26, (int16)intno) +#define Jenabint(intno) xbios(27, (int16)intno) +#define Supexec(func) xbios(38, (void *)func) +//#define Puntaes() xbios(39) +#define DMAread(sect, count, buf, dev) xbios(42, (int32)sect, (int16)count, (void *)buf, (int16)dev) +#define DMAwrite(sect, count, buf, dev) xbios(43, (int32)sect, (int16)count, (void *)buf, (int16)dev) +#define NVMaccess(op, start, count, buffer) xbios(46, (int16)op, (int16)start, (int16)count, (char *)buffer) +#define VsetMode(mode) xbios(88, (int16)mode) +#define VgetMonitor() xbios(89) +#define Locksnd() xbios(128) +#define Unlocksnd() xbios(129) + /* * Atari GEMDOS calls */ From mmu_man at mail.berlios.de Wed Jan 2 00:25:35 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 2 Jan 2008 00:25:35 +0100 Subject: [Haiku-commits] r23211 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801012325.m01NPZdi018118@sheep.berlios.de> Author: mmu_man Date: 2008-01-02 00:25:35 +0100 (Wed, 02 Jan 2008) New Revision: 23211 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23211&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.cpp haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.h haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: This should be enough for keyboard handling. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.cpp 2008-01-01 22:52:03 UTC (rev 23210) +++ haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.cpp 2008-01-01 23:25:35 UTC (rev 23211) @@ -10,26 +10,15 @@ #include -static uint16 +static uint32 check_for_key(void) { -//XXX: non blocking in ? -#if 0 - bios_regs regs; - regs.eax = 0x0100; - call_bios(0x16, ®s); - - // the zero flag is set when there is no key stroke waiting for us - if (regs.flags & ZERO_FLAG) + union key k; + if (Bconstat(DEV_CON) == 0) return 0; - // remove the key from the buffer - regs.eax = 0; - call_bios(0x16, ®s); - - return regs.eax & 0xffff; -#endif - return 0; + k.d0 = Bconin(DEV_CON); + return k.d0; } @@ -45,7 +34,7 @@ wait_for_key(void) { union key key; - key.d0 = Bconin(2); + key.d0 = Bconin(DEV_CON); return key; } @@ -57,7 +46,7 @@ union key key; uint32 options = 0; - while ((key.ax = check_for_key()) != 0) { + while ((key.d0 = check_for_key()) != 0) { switch (key.code.ascii) { case ' ': options |= BOOT_OPTION_MENU; Modified: haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.h 2008-01-01 22:52:03 UTC (rev 23210) +++ haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.h 2008-01-01 23:25:35 UTC (rev 23211) @@ -8,8 +8,10 @@ union key { uint32 d0; struct { - uint16 bios; // scan code - uint16 ascii; + uint8 modifiers; // not always present! + uint8 bios; // scan code + uint8 dummy; + uint8 ascii; } code; }; Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-01 22:52:03 UTC (rev 23210) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-01 23:25:35 UTC (rev 23211) @@ -16,6 +16,7 @@ #define DEV_PRINTER 0 #define DEV_AUX 1 #define DEV_CON 2 +#define DEV_CONSOLE 2 #define DEV_MIDI 3 #define DEV_IKBD 4 #define DEV_RAW 5 From mmu_man at mail.berlios.de Wed Jan 2 00:57:43 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 2 Jan 2008 00:57:43 +0100 Subject: [Haiku-commits] r23212 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801012357.m01NvhEQ029130@sheep.berlios.de> Author: mmu_man Date: 2008-01-02 00:57:42 +0100 (Wed, 02 Jan 2008) New Revision: 23212 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23212&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.cpp haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: Fixes. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.cpp 2008-01-01 23:25:35 UTC (rev 23211) +++ haiku/trunk/src/system/boot/platform/atari_m68k/keyboard.cpp 2008-01-01 23:57:42 UTC (rev 23212) @@ -5,7 +5,7 @@ #include "keyboard.h" -#include "bios.h" +#include "toscalls.h" #include Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-01 23:25:35 UTC (rev 23211) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-01 23:57:42 UTC (rev 23212) @@ -50,7 +50,7 @@ #define K_INSERT 0x40 #define RW_READ 0x00 -#define RW_READ 0x01 +#define RW_WRITE 0x01 #define RW_NOMEDIACH 0x02 #define RW_NORETRY 0x04 #define RW_NOTRANSLATE 0x08 From mmu_man at mail.berlios.de Wed Jan 2 01:02:05 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 2 Jan 2008 01:02:05 +0100 Subject: [Haiku-commits] r23213 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801020002.m02025Qc031986@sheep.berlios.de> Author: mmu_man Date: 2008-01-02 01:02:04 +0100 (Wed, 02 Jan 2008) New Revision: 23213 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23213&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: Official names Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-01 23:57:42 UTC (rev 23212) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-02 00:02:04 UTC (rev 23213) @@ -113,12 +113,11 @@ extern int32 gemdos(uint16 nr, ...); // official names +#define Pterm0() gemdos(0) #define Cconin() gemdos(1) #define Super(a) gemdos(0x20, (uint32)a) +#define Pterm(retcode) gemdos(76, (int16)retcode) -// check for names -#define terminate() GEMDOS(0) - /* * error mapping * in debug.c From mmu_man at mail.berlios.de Wed Jan 2 01:38:11 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 2 Jan 2008 01:38:11 +0100 Subject: [Haiku-commits] r23214 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801020038.m020cBHd007848@sheep.berlios.de> Author: mmu_man Date: 2008-01-02 01:38:11 +0100 (Wed, 02 Jan 2008) New Revision: 23214 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23214&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile Log: stage2_args.h uses #include , had to use UsePrivateHeaders. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-02 00:02:04 UTC (rev 23213) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-02 00:38:11 UTC (rev 23214) @@ -2,6 +2,7 @@ SubDirHdrs $(HAIKU_TOP) headers private kernel boot platform $(TARGET_BOOT_PLATFORM) ; +UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders [ FDirName graphics common ] ; #UsePrivateHeaders [ FDirName graphics vesa ] ; From revol at free.fr Wed Jan 2 02:02:15 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Wed, 02 Jan 2008 02:02:15 +0100 CET Subject: [Haiku-commits] r23177 - haiku/trunk/src/apps/aboutsystem In-Reply-To: <3033861406-BeMail@zon> Message-ID: <36717679814-BeMail@laptop> > > > New Revision: 23177 > > > Log: > > > Add a list of installed apps and their copyrights to the credits > > > view, using a query. > > I just tried this and took a look at the list. While I find the use > > of > > a query to do this quite cool and elegant, I somehow have concerns > > about having it where it is now. I would find it most suitable and > > useful in an installer/package manager style application. Putting > > it > > into AboutSystem with no filtering somehow looks to me as if 3rd > > party > > software was "endorsed" by Haiku even if there is no connection at > > all. > > On a plain installation it obviously only lists stuff actually > > brought > > in by Haiku which is not a problem. But on my system here where I > > put > > a > > lot of R5 stuff to test, the list somehow does not fit anymore. > > This > > is > > just my opinion though and I don't have strong feelings about it. > > So > > if > > everyone else has no such concerns it's a non-issue. > > Same here, I just wanted to have a look at it before I speak up > (still > didn't find the time yet). Ideally that would also list the libraries and add-ons and avoid having to maintain the hardcoded list except for internal code. Of course that'd would need filtering. However the app is now named "AboutSystem", not AboutHaiku anymore, which means it gives info about the whole system (and later the distro). So I think it might be the good place for it. We could filter Haiku stuff first, then list installed apps separately. But i was really just for testing, might need some work/rewording. Fran?ois. From mmu_man at mail.berlios.de Wed Jan 2 02:37:03 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 2 Jan 2008 02:37:03 +0100 Subject: [Haiku-commits] r23215 - haiku/trunk/src/add-ons/kernel/partitioning_systems/atari Message-ID: <200801020137.m021b3ZP012466@sheep.berlios.de> Author: mmu_man Date: 2008-01-02 02:37:02 +0100 (Wed, 02 Jan 2008) New Revision: 23215 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23215&view=rev Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/atari/atari.h Log: Typos Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/atari/atari.h =================================================================== --- haiku/trunk/src/add-ons/kernel/partitioning_systems/atari/atari.h 2008-01-02 00:38:11 UTC (rev 23214) +++ haiku/trunk/src/add-ons/kernel/partitioning_systems/atari/atari.h 2008-01-02 01:37:02 UTC (rev 23215) @@ -21,11 +21,11 @@ #define ATARI_PART_BOOTABLE 0x80 uint8 flags; /* some known types */ -#define ATARI_PART_TYEP_GEM 'G', 'E', 'M' -#define ATARI_PART_TYEP_LNX 'L', 'N', 'X' -#define ATARI_PART_TYEP_OS9 'O', 'S', '9' +#define ATARI_PART_TYPE_GEM 'G', 'E', 'M' +#define ATARI_PART_TYPE_LNX 'L', 'N', 'X' +#define ATARI_PART_TYPE_OS9 'O', 'S', '9' /* the one we'll use */ -#define ATARI_PART_TYEP_BFS 'B', 'F', 'S' +#define ATARI_PART_TYPE_BFS 'B', 'F', 'S' char id[3]; uint32 start; uint32 size; From mmlr at mail.berlios.de Wed Jan 2 03:07:24 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Wed, 2 Jan 2008 03:07:24 +0100 Subject: [Haiku-commits] r23216 - haiku/trunk/src/system/boot/platform/bios_ia32 Message-ID: <200801020207.m0227OQ0013846@sheep.berlios.de> Author: mmlr Date: 2008-01-02 03:07:23 +0100 (Wed, 02 Jan 2008) New Revision: 23216 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23216&view=rev Modified: haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp haiku/trunk/src/system/boot/platform/bios_ia32/smp.h haiku/trunk/src/system/boot/platform/bios_ia32/start.c Log: * Delay initializing SMP stuff like APICs and kstacks of non-boot CPUs until after the boot menu * When disabling SMP initialization of those parts is avoided so it works more cleanly * Moved smp_find_mp_config() into smp_init() and moved MPS specific parts into smp_do_mp_config() * Removed the global floating struct, if found it is now passed into smp_do_mp_config() like it is done for ACPI * Made the file a bit more C++, applied coding style to some variable names and unified/improved some of the debug output Modified: haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp 2008-01-02 01:37:02 UTC (rev 23215) +++ haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp 2008-01-02 02:07:23 UTC (rev 23216) @@ -60,8 +60,6 @@ extern "C" void smp_trampoline_end(void); -static struct mp_floating_struct *sFloatingStruct = NULL; - static int smp_get_current_cpu(void); @@ -90,19 +88,17 @@ } -static uint32 * +static mp_floating_struct * smp_mp_probe(uint32 base, uint32 limit) { - uint32 *ptr; - TRACE(("smp_mp_probe: entry base 0x%lx, limit 0x%lx\n", base, limit)); - - for (ptr = (uint32 *) base; (uint32)ptr < limit; ptr++) { - if (*ptr == MP_FLOATING_SIGNATURE) { - TRACE(("smp_mp_probe: found floating pointer structure at %p\n", ptr)); - return ptr; + for (uint32 *pointer = (uint32 *)base; (uint32)pointer < limit; pointer++) { + if (*pointer == MP_FLOATING_SIGNATURE) { + TRACE(("smp_mp_probe: found floating pointer structure at %p\n", pointer)); + return (mp_floating_struct *)pointer; } } + return NULL; } @@ -122,28 +118,43 @@ } -static void -smp_do_mp_config() +static status_t +smp_do_mp_config(mp_floating_struct *floatingStruct) { - struct mp_config_table *config; - char *ptr; - int i; -#ifdef TRACE_SMP - const char *cpu_family[] = { "", "", "", "", "Intel 486", - "Intel Pentium", "Intel Pentium Pro", "Intel Pentium II" }; + TRACE(("smp: intel mp version %s, %s", + (floatingStruct->spec_revision == 1) ? "1.1" : "1.4", + (floatingStruct->mp_feature_2 & 0x80) + ? "imcr and pic compatibility mode.\n" + : "virtual wire compatibility mode.\n")); + + if (floatingStruct->config_table == NULL) { +#if 1 + // XXX need to implement + TRACE(("smp: standard configuration %d unimplemented\n", floatingStruct->mp_feature_1)); + gKernelArgs.num_cpus = 1; + return B_OK; +#else + /* this system conforms to one of the default configurations */ + TRACE(("smp: standard configuration %d\n", floatingStruct->mp_feature_1)); + gKernelArgs.num_cpus = 2; + gKernelArgs.cpu_apic_id[0] = 0; + gKernelArgs.cpu_apic_id[1] = 1; + apic_phys = (unsigned int *) 0xfee00000; + ioapic_phys = (unsigned int *) 0xfec00000; + dprintf("smp: WARNING: standard configuration code is untested"); + return B_OK; #endif + } /* * we are not running in standard configuration, so we have to look through * all of the mp configuration table crap to figure out how many processors * we have, where our apics are, etc. */ + mp_config_table *config = floatingStruct->config_table; gKernelArgs.num_cpus = 0; - config = sFloatingStruct->config_table; - /* print out our new found configuration. */ - TRACE(("smp: oem id: %.8s product id: %.12s\n", config->oem, config->product)); TRACE(("smp: base table has %d entries, extended section %d bytes\n", @@ -151,58 +162,62 @@ gKernelArgs.arch_args.apic_phys = (uint32)config->apic; - ptr = (char *)((uint32)config + sizeof(struct mp_config_table)); - for (i = 0; i < config->num_base_entries; i++) { - switch (*ptr) { + char *pointer = (char *)((uint32)config + sizeof(struct mp_config_table)); + for (int32 i = 0; i < config->num_base_entries; i++) { + switch (*pointer) { case MP_BASE_PROCESSOR: { if (gKernelArgs.num_cpus == MAX_BOOT_CPUS) { TRACE(("smp: already reached maximum boot CPUs (%d)\n", MAX_BOOT_CPUS)); - ptr += sizeof(struct mp_base_processor); + pointer += sizeof(struct mp_base_processor); break; } - struct mp_base_processor *processor = (struct mp_base_processor *)ptr; + struct mp_base_processor *processor = (struct mp_base_processor *)pointer; gKernelArgs.arch_args.cpu_apic_id[gKernelArgs.num_cpus] = processor->apic_id; gKernelArgs.arch_args.cpu_os_id[processor->apic_id] = gKernelArgs.num_cpus; gKernelArgs.arch_args.cpu_apic_version[gKernelArgs.num_cpus] = processor->apic_version; +#ifdef TRACE_SMP + const char *cpuFamily[] = { "", "", "", "", "Intel 486", + "Intel Pentium", "Intel Pentium Pro", "Intel Pentium II" }; +#endif TRACE(("smp: cpu#%ld: %s, apic id %d, version %d%s\n", - gKernelArgs.num_cpus, cpu_family[(processor->signature & 0xf00) >> 8], + gKernelArgs.num_cpus, cpuFamily[(processor->signature & 0xf00) >> 8], processor->apic_id, processor->apic_version, (processor->cpu_flags & 0x2) ? ", BSP" : "")); gKernelArgs.num_cpus++; - ptr += sizeof(struct mp_base_processor); + pointer += sizeof(struct mp_base_processor); break; } case MP_BASE_BUS: { - struct mp_base_bus *bus = (struct mp_base_bus *)ptr; + struct mp_base_bus *bus = (struct mp_base_bus *)pointer; TRACE(("smp: bus %d: %c%c%c%c%c%c\n", bus->bus_id, bus->name[0], bus->name[1], bus->name[2], bus->name[3], bus->name[4], bus->name[5])); - ptr += sizeof(struct mp_base_bus); + pointer += sizeof(struct mp_base_bus); break; } case MP_BASE_IO_APIC: { - struct mp_base_ioapic *io = (struct mp_base_ioapic *) ptr; + struct mp_base_ioapic *io = (struct mp_base_ioapic *)pointer; gKernelArgs.arch_args.ioapic_phys = (uint32)io->addr; TRACE(("smp: found io apic with apic id %d, version %d\n", io->ioapic_id, io->ioapic_version)); - ptr += sizeof(struct mp_base_ioapic); + pointer += sizeof(struct mp_base_ioapic); break; } case MP_BASE_IO_INTR: case MP_BASE_LOCAL_INTR: { - struct mp_base_interrupt *interrupt = (struct mp_base_interrupt *)ptr; + struct mp_base_interrupt *interrupt = (struct mp_base_interrupt *)pointer; dprintf("smp: %s int: type %d, source bus %d, irq %3d, dest apic %d, int %3d, polarity %d, trigger mode %d\n", interrupt->type == MP_BASE_IO_INTR ? "I/O" : "local", @@ -210,7 +225,7 @@ interrupt->source_bus_irq, interrupt->dest_apic_id, interrupt->dest_apic_int, interrupt->polarity, interrupt->trigger_mode); - ptr += sizeof(struct mp_base_interrupt); + pointer += sizeof(struct mp_base_interrupt); break; } } @@ -221,9 +236,7 @@ (void *)gKernelArgs.arch_args.ioapic_phys, gKernelArgs.num_cpus); - // this BIOS looks broken, because it didn't report any cpus (VMWare) - if (gKernelArgs.num_cpus == 0) - gKernelArgs.num_cpus = 1; + return gKernelArgs.num_cpus > 0 ? B_OK : B_ERROR; } @@ -313,69 +326,6 @@ } -static int -smp_find_mp_config(void) -{ - int i; - -#if NO_SMP - if (1) - return gKernelArgs.num_cpus = 1; -#endif - - // first try to find ACPI tables to get MP configuration as it handles - // physical as well as logical MP configurations as in multiple cpus, - // multiple cores or hyper threading. - for (i = 0; acpi_scan_spots[i].length > 0; i++) { - acpi_rsdp *rsdp = smp_acpi_probe(smp_scan_spots[i].start, - smp_scan_spots[i].stop); - if (rsdp != NULL && smp_do_acpi_config(rsdp) == B_OK) - return gKernelArgs.num_cpus; - } - - for (i = 0; smp_scan_spots[i].length > 0; i++) { - sFloatingStruct = (struct mp_floating_struct *)smp_mp_probe(smp_scan_spots[i].start, - smp_scan_spots[i].stop); - if (sFloatingStruct != NULL) - break; - } - - if (sFloatingStruct != NULL) { - TRACE(("smp_boot: intel mp version %s, %s", - (sFloatingStruct->spec_revision == 1) ? "1.1" : "1.4", - (sFloatingStruct->mp_feature_2 & 0x80) - ? "imcr and pic compatibility mode.\n" - : "virtual wire compatibility mode.\n")); - - if (sFloatingStruct->config_table == NULL) { - // XXX need to implement -#if 1 - TRACE(("smp: standard configuration %d unimplemented\n", sFloatingStruct->mp_feature_1)); - gKernelArgs.num_cpus = 1; - return 1; -#else - /* this system conforms to one of the default configurations */ -// mp_num_def_config = sFloatingStruct->mp_feature_1; - TRACE(("smp: standard configuration %d\n", sFloatingStruct->mp_feature_1)); -/* num_cpus = 2; - gKernelArgs.cpu_apic_id[0] = 0; - gKernelArgs.cpu_apic_id[1] = 1; - apic_phys = (unsigned int *) 0xfee00000; - ioapic_phys = (unsigned int *) 0xfec00000; - kprintf ("smp: WARNING: standard configuration code is untested"); -*/ -#endif - } else { - smp_do_mp_config(); - } - - return gKernelArgs.num_cpus; - } - - return gKernelArgs.num_cpus = 1; -} - - /** Target function of the trampoline code. * The trampoline code should have the pgdir and a gdt set up for us, * along with us being on the final stack for this processor. We need @@ -459,16 +409,13 @@ void -smp_boot_other_cpus(void) +smp_init_other_cpus(void) { - uint32 trampolineCode; - uint32 trampolineStack; - uint32 i; - void *handle = load_driver_settings(B_SAFEMODE_DRIVER_SETTINGS); if (handle != NULL) { if (get_driver_boolean_parameter(handle, B_SAFEMODE_DISABLE_SMP, false, false)) { // SMP has been disabled! + TRACE(("smp disabled per safemode setting\n")); gKernelArgs.num_cpus = 1; } unload_driver_settings(handle); @@ -477,6 +424,36 @@ if (gKernelArgs.num_cpus < 2) return; + TRACE(("smp: found %ld cpus\n", gKernelArgs.num_cpus)); + TRACE(("smp: apic_phys = %p\n", (void *)gKernelArgs.arch_args.apic_phys)); + TRACE(("smp: ioapic_phys = %p\n", (void *)gKernelArgs.arch_args.ioapic_phys)); + + // map in the apic & ioapic + gKernelArgs.arch_args.apic = (uint32 *)mmu_map_physical_memory( + gKernelArgs.arch_args.apic_phys, B_PAGE_SIZE, kDefaultPageFlags); + gKernelArgs.arch_args.ioapic = (uint32 *)mmu_map_physical_memory( + gKernelArgs.arch_args.ioapic_phys, B_PAGE_SIZE, kDefaultPageFlags); + + TRACE(("smp: apic = %p\n", gKernelArgs.arch_args.apic)); + TRACE(("smp: ioapic = %p\n", gKernelArgs.arch_args.ioapic)); + + // calculate how fast the apic timer is + calculate_apic_timer_conversion_factor(); + + for (uint32 i = 1; i < gKernelArgs.num_cpus; i++) { + // create a final stack the trampoline code will put the ap processor on + gKernelArgs.cpu_kstack[i].start = (addr_t)mmu_allocate(NULL, KERNEL_STACK_SIZE); + gKernelArgs.cpu_kstack[i].size = KERNEL_STACK_SIZE; + } +} + + +void +smp_boot_other_cpus(void) +{ + if (gKernelArgs.num_cpus < 2) + return; + TRACE(("trampolining other cpus\n")); // The first 8 MB are identity mapped, either 0x9e000-0x9ffff is reserved for @@ -486,11 +463,11 @@ // (these have to be < 1M physical, 0xa0000-0xfffff is reserved by the BIOS, // and when PXE services are used, the 0x8d000-0x9ffff is also reserved) #ifdef _PXE_ENV - trampolineCode = 0x8b000; - trampolineStack = 0x8c000; + uint32 trampolineCode = 0x8b000; + uint32 trampolineStack = 0x8c000; #else - trampolineCode = 0x9f000; - trampolineStack = 0x9e000; + uint32 trampolineCode = 0x9f000; + uint32 trampolineStack = 0x9e000; #endif // copy the trampoline code over @@ -498,7 +475,7 @@ (uint32)&smp_trampoline_end - (uint32)&smp_trampoline); // boot the cpus - for (i = 1; i < gKernelArgs.num_cpus; i++) { + for (uint32 i = 1; i < gKernelArgs.num_cpus; i++) { uint32 *finalStack; uint32 *tempStack; uint32 config; @@ -611,31 +588,29 @@ void smp_init(void) { - if (smp_find_mp_config() > 1) { - uint32 i; +#if NO_SMP + gKernelArgs.num_cpus = 1; + return; +#endif - TRACE(("smp_boot: had found > 1 cpus\n")); - TRACE(("post config:\n")); - TRACE(("num_cpus = %ld\n", gKernelArgs.num_cpus)); - TRACE(("apic_phys = %p\n", (void *)gKernelArgs.arch_args.apic_phys)); - TRACE(("ioapic_phys = %p\n", (void *)gKernelArgs.arch_args.ioapic_phys)); + // first try to find ACPI tables to get MP configuration as it handles + // physical as well as logical MP configurations as in multiple cpus, + // multiple cores or hyper threading. + for (int32 i = 0; acpi_scan_spots[i].length > 0; i++) { + acpi_rsdp *rsdp = smp_acpi_probe(smp_scan_spots[i].start, + smp_scan_spots[i].stop); + if (rsdp != NULL && smp_do_acpi_config(rsdp) == B_OK) + return; + } - // map in the apic & ioapic - gKernelArgs.arch_args.apic = (uint32 *)mmu_map_physical_memory( - gKernelArgs.arch_args.apic_phys, B_PAGE_SIZE, kDefaultPageFlags); - gKernelArgs.arch_args.ioapic = (uint32 *)mmu_map_physical_memory( - gKernelArgs.arch_args.ioapic_phys, B_PAGE_SIZE, kDefaultPageFlags); - - TRACE(("apic = %p\n", gKernelArgs.arch_args.apic)); - TRACE(("ioapic = %p\n", gKernelArgs.arch_args.ioapic)); - - // calculate how fast the apic timer is - calculate_apic_timer_conversion_factor(); - - for (i = 1; i < gKernelArgs.num_cpus; i++) { - // create a final stack the trampoline code will put the ap processor on - gKernelArgs.cpu_kstack[i].start = (addr_t)mmu_allocate(NULL, KERNEL_STACK_SIZE); - gKernelArgs.cpu_kstack[i].size = KERNEL_STACK_SIZE; - } + // then try to find MPS tables and do configuration based on them + for (int32 i = 0; smp_scan_spots[i].length > 0; i++) { + mp_floating_struct *floatingStruct = smp_mp_probe( + smp_scan_spots[i].start, smp_scan_spots[i].stop); + if (floatingStruct != NULL && smp_do_mp_config(floatingStruct) == B_OK) + return; } + + // everything failed or we are not running an SMP system + gKernelArgs.num_cpus = 1; } Modified: haiku/trunk/src/system/boot/platform/bios_ia32/smp.h =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/smp.h 2008-01-02 01:37:02 UTC (rev 23215) +++ haiku/trunk/src/system/boot/platform/bios_ia32/smp.h 2008-01-02 02:07:23 UTC (rev 23216) @@ -18,6 +18,7 @@ #endif extern void smp_init(void); +extern void smp_init_other_cpus(void); extern void smp_boot_other_cpus(void); #ifdef __cplusplus Modified: haiku/trunk/src/system/boot/platform/bios_ia32/start.c =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/start.c 2008-01-02 01:37:02 UTC (rev 23215) +++ haiku/trunk/src/system/boot/platform/bios_ia32/start.c 2008-01-02 02:07:23 UTC (rev 23216) @@ -75,6 +75,7 @@ // or I don't see something important... addr_t stackTop = gKernelArgs.cpu_kstack[0].start + gKernelArgs.cpu_kstack[0].size; + smp_init_other_cpus(); serial_cleanup(); mmu_init_for_kernel(); smp_boot_other_cpus(); From mmlr at mail.berlios.de Wed Jan 2 03:10:56 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Wed, 2 Jan 2008 03:10:56 +0100 Subject: [Haiku-commits] r23217 - haiku/trunk/src/system/boot/platform/bios_ia32 Message-ID: <200801020210.m022AuEG013977@sheep.berlios.de> Author: mmlr Date: 2008-01-02 03:10:55 +0100 (Wed, 02 Jan 2008) New Revision: 23217 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23217&view=rev Modified: haiku/trunk/src/system/boot/platform/bios_ia32/cpu.cpp haiku/trunk/src/system/boot/platform/bios_ia32/serial.cpp Log: * Two more uses for the pause instruction I apparently forgot to commit * Minor style cleanup in the conversion factor calculation Modified: haiku/trunk/src/system/boot/platform/bios_ia32/cpu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/cpu.cpp 2008-01-02 02:07:23 UTC (rev 23216) +++ haiku/trunk/src/system/boot/platform/bios_ia32/cpu.cpp 2008-01-02 02:10:55 UTC (rev 23217) @@ -59,7 +59,7 @@ out8(0x00, 0x43); /* latch counter value */ s_low = in8(0x40); s_high = in8(0x40); - } while(s_high != 255); + } while (s_high != 255); t1 = rdtsc(); do { out8(0x00, 0x43); /* latch counter value */ @@ -77,13 +77,13 @@ out8(0x00, 0x43); /* latch counter value */ s_low = in8(0x40); s_high = in8(0x40); - } while (s_high!= 255); + } while (s_high != 255); t1 = rdtsc(); do { out8(0x00, 0x43); /* latch counter value */ low = in8(0x40); high = in8(0x40); - } while (high> 192); + } while (high > 192); t2 = rdtsc(); p2 = t2-t1; r2 = (double)(p2) / (double)(((s_high << 8) | s_low) - ((high << 8) | low)); @@ -101,7 +101,7 @@ out8(0x00, 0x43); /* latch counter value */ s_low = in8(0x40); s_high = in8(0x40); - } while (s_high!= 255); + } while (s_high != 255); t1 = rdtsc(); do { out8(0x00, 0x43); /* latch counter value */ @@ -246,8 +246,8 @@ { bigtime_t time = system_time(); - while((system_time() - time) < microseconds) - ; + while ((system_time() - time) < microseconds) + asm volatile ("pause;"); } Modified: haiku/trunk/src/system/boot/platform/bios_ia32/serial.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/serial.cpp 2008-01-02 02:07:23 UTC (rev 23216) +++ haiku/trunk/src/system/boot/platform/bios_ia32/serial.cpp 2008-01-02 02:10:55 UTC (rev 23217) @@ -43,7 +43,7 @@ { // wait until the transmitter empty bit is set while ((in8(sSerialBasePort + SERIAL_LINE_STATUS) & 0x20) == 0) - ; + asm volatile ("pause;"); out8(c, sSerialBasePort + SERIAL_TRANSMIT_BUFFER); } From axeld at mail.berlios.de Wed Jan 2 17:16:28 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Jan 2008 17:16:28 +0100 Subject: [Haiku-commits] r23218 - haiku/trunk/src/kits/network/dns/irs Message-ID: <200801021616.m02GGSBx005765@sheep.berlios.de> Author: axeld Date: 2008-01-02 17:16:28 +0100 (Wed, 02 Jan 2008) New Revision: 23218 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23218&view=rev Modified: haiku/trunk/src/kits/network/dns/irs/lcl_ho.c Log: If there is no /etc/hosts file, we now add a "localhost 127.0.0.1" definition internally. This fixes #1688. Modified: haiku/trunk/src/kits/network/dns/irs/lcl_ho.c =================================================================== --- haiku/trunk/src/kits/network/dns/irs/lcl_ho.c 2008-01-02 02:10:55 UTC (rev 23217) +++ haiku/trunk/src/kits/network/dns/irs/lcl_ho.c 2008-01-02 16:16:28 UTC (rev 23218) @@ -1,4 +1,9 @@ /* + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ + +/* * Copyright (c) 1985, 1988, 1993 * The Regents of the University of California. All rights reserved. * @@ -105,6 +110,7 @@ struct pvt { FILE * fp; + int index; struct hostent host; char * h_addr_ptrs[MAXADDRS + 1]; char * host_aliases[MAXALIASES]; @@ -333,9 +339,25 @@ if (!pvt->fp) ho_rewind(this); if (!pvt->fp) { - RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL); - return (NULL); + if (pvt->index > 0) + return (NULL); + + strcpy(pvt->hostbuf, "localhost"); + pvt->host_aliases[0] = pvt->hostbuf; + pvt->host_aliases[1] = NULL; + pvt->h_addr_ptrs[0] = (char *)pvt->host_addr; + pvt->h_addr_ptrs[1] = NULL; + pvt->host.h_addr_list = pvt->h_addr_ptrs; + pvt->host.h_length = INADDRSZ; + pvt->host.h_addrtype = AF_INET; + pvt->host.h_aliases = pvt->host_aliases; + ((struct in_addr *)pvt->host_addr)->s_addr = INADDR_LOOPBACK; + pvt->index++; + + RES_SET_H_ERRNO(pvt->res, NETDB_SUCCESS); + return (&pvt->host); } + bufp = pvt->hostbuf; bufsiz = sizeof pvt->hostbuf; offset = 0; @@ -433,8 +455,10 @@ return; (void)fclose(pvt->fp); } - if (!(pvt->fp = fopen(_PATH_HOSTS, "r"))) + if (!(pvt->fp = fopen(_PATH_HOSTS, "r"))) { + pvt->index = 0; return; + } if (fcntl(fileno(pvt->fp), F_SETFD, 1) < 0) { (void)fclose(pvt->fp); pvt->fp = NULL; From marcusoverhagen at mail.berlios.de Wed Jan 2 18:33:28 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 2 Jan 2008 18:33:28 +0100 Subject: [Haiku-commits] r23219 - haiku/trunk/src/system/kernel Message-ID: <200801021733.m02HXSBq017621@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-02 18:33:27 +0100 (Wed, 02 Jan 2008) New Revision: 23219 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23219&view=rev Modified: haiku/trunk/src/system/kernel/int.c Log: Disable an io interrupt when more than 99% are unhandled. This somewhat prevents random freezing. Modified: haiku/trunk/src/system/kernel/int.c =================================================================== --- haiku/trunk/src/system/kernel/int.c 2008-01-02 16:16:28 UTC (rev 23218) +++ haiku/trunk/src/system/kernel/int.c 2008-01-02 17:33:27 UTC (rev 23219) @@ -43,6 +43,8 @@ #ifdef DEBUG_INT int64 handled_count; int64 unhandled_count; + int trigger_count; + int ignored_count; #endif }; @@ -125,6 +127,8 @@ #ifdef DEBUG_INT io_vectors[i].handled_count = 0; io_vectors[i].unhandled_count = 0; + io_vectors[i].trigger_count = 0; + io_vectors[i].ignored_count = 0; #endif initque(&io_vectors[i].handler_list); /* initialize handler queue */ } @@ -283,10 +287,23 @@ } #ifdef DEBUG_INT - if (status != B_UNHANDLED_INTERRUPT) + io_vectors[vector].trigger_count++; + if (status != B_UNHANDLED_INTERRUPT) { io_vectors[vector].handled_count++; - else + } else { io_vectors[vector].unhandled_count++; + io_vectors[vector].ignored_count++; + } + // disable interrupt when more than 99% are unhandled + if (io_vectors[vector].trigger_count > 100000) { + if (io_vectors[vector].ignored_count > 99000) { + io_vectors[vector].enable_count = -100; + arch_int_disable_io_interrupt(vector); + dprintf("Disabling unhandled io interrupt %d\n", vector); + } + io_vectors[vector].trigger_count = 0; + io_vectors[vector].ignored_count = 0; + } #endif release_spinlock(&io_vectors[vector].vector_lock); From axeld at mail.berlios.de Wed Jan 2 19:44:40 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Jan 2008 19:44:40 +0100 Subject: [Haiku-commits] r23220 - in haiku/trunk: headers/private/graphics/intel_extreme src/add-ons/kernel/drivers/graphics/intel_extreme Message-ID: <200801021844.m02IieRf031125@sheep.berlios.de> Author: axeld Date: 2008-01-02 19:44:39 +0100 (Wed, 02 Jan 2008) New Revision: 23220 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23220&view=rev Modified: haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h Log: * Added support for the G33 line of chips: mode setting and acceleration is working fine AFAICT. * Implemented mapping the GTT area for i9xx chips other than the i965. This should also fix the driver working with these chips at all. * The memory used by the driver now take the GTT area into account - before the GTT could be overwritten theoretically... * Added fix for some i965 quirks from the X driver. * Added some overlay definitions for the i965. * Started support for G33 overlay (not complete yet). Modified: haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h =================================================================== --- haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h 2008-01-02 17:33:27 UTC (rev 23219) +++ haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h 2008-01-02 18:44:39 UTC (rev 23220) @@ -27,9 +27,10 @@ #define INTEL_TYPE_9xx 0x04 #define INTEL_TYPE_83x 0x10 #define INTEL_TYPE_85x 0x20 -#define INTEL_TYPE_915 0x10 +#define INTEL_TYPE_91x 0x10 #define INTEL_TYPE_945 0x20 #define INTEL_TYPE_965 0x40 +#define INTEL_TYPE_G33 0x80 #define DEVICE_NAME "intel_extreme" #define INTEL_ACCELERANT_NAME "intel_extreme.accelerant" @@ -84,6 +85,7 @@ bool overlay_active; uint32 overlay_token; uint8* physical_overlay_registers; + uint32 overlay_offset; bool hardware_cursor_enabled; sem_id vblank_sem; @@ -138,13 +140,18 @@ // PCI bridge memory management #define INTEL_GRAPHICS_MEMORY_CONTROL 0x52 +#define MEMORY_MASK 0x01 #define STOLEN_MEMORY_MASK 0x70 +#define i965_GTT_MASK 0x000e +#define G33_GTT_MASK 0x0300 // models i830 and up #define i830_LOCAL_MEMORY_ONLY 0x10 #define i830_STOLEN_512K 0x20 #define i830_STOLEN_1M 0x30 #define i830_STOLEN_8M 0x40 +#define i830_FRAME_BUFFER_64M 0x01 +#define i830_FRAME_BUFFER_128M 0x00 // models i855 and up #define i855_STOLEN_MEMORY_1M 0x10 @@ -154,6 +161,8 @@ #define i855_STOLEN_MEMORY_32M 0x50 #define i855_STOLEN_MEMORY_48M 0x60 #define i855_STOLEN_MEMORY_64M 0x70 +#define i855_STOLEN_MEMORY_128M 0x80 +#define i855_STOLEN_MEMORY_256M 0x90 // graphics page translation table #define INTEL_PAGE_TABLE_CONTROL 0x02020 @@ -163,6 +172,11 @@ #define i830_GTT_SIZE 0x20000 #define i965_GTT_BASE 0x80000 // (- 0xfffff) #define i965_GTT_SIZE 0x80000 +#define i965_GTT_128K (2 << 1) +#define i965_GTT_256K (1 << 1) +#define i965_GTT_512K (0 << 1) +#define G33_GTT_1M (1 << 8) +#define G33_GTT_2M (2 << 8) #define GTT_ENTRY_VALID 0x01 #define GTT_ENTRY_LOCAL_MEMORY 0x02 @@ -481,12 +495,21 @@ uint32 _reserved20; + uint32 start_0y; + uint32 start_1y; + uint32 start_0u; + uint32 start_0v; + uint32 start_1u; + uint32 start_1v; + uint32 _reserved21[6]; +#if 0 // (0x70) AWINPOS - alpha blend window position uint32 awinpos; // (0x74) AWINSZ - alpha blend window size uint32 awinsz; uint32 _reserved21[10]; +#endif // (0xa0) FASTHSCALE - fast horizontal downscale (strangely enough, // the next two registers switch the usual Y/RGB vs. UV order) @@ -509,6 +532,10 @@ uint16 horizontal_coefficients_uv[128]; }; +// i965 overlay support is currently realized using its 3D hardware +#define INTEL_i965_OVERLAY_STATE_SIZE 36864 +#define INTEL_i965_3D_CONTEXT_SIZE 32768 + struct hardware_status { uint32 interrupt_status_register; uint32 _reserved0[3]; Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp 2008-01-02 17:33:27 UTC (rev 23219) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp 2008-01-02 18:44:39 UTC (rev 23220) @@ -42,15 +42,16 @@ {0x2572, INTEL_TYPE_8xx | INTEL_TYPE_85x, "i865G"}, {0x3582, INTEL_TYPE_8xx | INTEL_TYPE_85x, "i855G"}, -#if 1 - {0x2792, INTEL_TYPE_9xx, "i910"}, - {0x258a, INTEL_TYPE_9xx, "i915"}, - {0x2582, INTEL_TYPE_9xx, "i915G"}, - {0x2592, INTEL_TYPE_9xx, "i915GM"}, - {0x2772, INTEL_TYPE_9xx, "i945G"}, - {0x27a2, INTEL_TYPE_9xx, "i945GM"}, - {0x29a2, INTEL_TYPE_9xx | INTEL_TYPE_965, "i965G"} -#endif + {0x2792, INTEL_TYPE_9xx | INTEL_TYPE_91x, "i910"}, + {0x258a, INTEL_TYPE_9xx | INTEL_TYPE_91x, "i915"}, + {0x2582, INTEL_TYPE_9xx | INTEL_TYPE_91x, "i915G"}, + {0x2592, INTEL_TYPE_9xx | INTEL_TYPE_91x, "i915GM"}, + {0x2772, INTEL_TYPE_9xx | INTEL_TYPE_945, "i945G"}, + {0x27a2, INTEL_TYPE_9xx | INTEL_TYPE_945, "i945GM"}, + {0x29a2, INTEL_TYPE_9xx | INTEL_TYPE_965, "i965G"}, + {0x29b2, INTEL_TYPE_9xx | INTEL_TYPE_G33, "G33G"}, + {0x29c2, INTEL_TYPE_9xx | INTEL_TYPE_G33, "Q35G"}, + {0x29d2, INTEL_TYPE_9xx | INTEL_TYPE_G33, "Q33G"}, }; int32 api_version = B_CUR_DRIVER_API_VERSION; Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp 2008-01-02 17:33:27 UTC (rev 23219) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp 2008-01-02 18:44:39 UTC (rev 23220) @@ -104,7 +104,7 @@ read_settings(size_t &memorySize, bool &hardwareCursor, bool &ignoreAllocated) { size_t size = 8; // 8 MB - hardwareCursor = true; + hardwareCursor = false; ignoreAllocated = false; void *settings = load_driver_settings("intel_extreme"); @@ -145,7 +145,46 @@ // read stolen memory from the PCI configuration of the PCI bridge uint16 memoryConfig = gPCI->read_pci_config(0, 0, 0, INTEL_GRAPHICS_MEMORY_CONTROL, 2); size_t memorySize = 1 << 20; // 1 MB + size_t gttSize = 0; + // TODO: check if the GTT is really part of the stolen memory + if (info.device_type == (INTEL_TYPE_9xx | INTEL_TYPE_965)) { + switch (memoryConfig & i965_GTT_MASK) { + case i965_GTT_128K: + gttSize = 128 << 10; + break; + case i965_GTT_256K: + gttSize = 256 << 10; + break; + case i965_GTT_512K: + gttSize = 512 << 10; + break; + } + } else if (info.device_type == (INTEL_TYPE_9xx | INTEL_TYPE_G33)) { + switch (memoryConfig & G33_GTT_MASK) { + case G33_GTT_1M: + gttSize = 1 << 20; + break; + case G33_GTT_2M: + 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 + size_t frameBufferSize = 0; + if ((info.device_type & INTEL_TYPE_FAMILY_MASK) == INTEL_TYPE_8xx) { + if ((info.device_type & INTEL_TYPE_83x) != 0 + && (memoryConfig & MEMORY_MASK) == i830_FRAME_BUFFER_64M) + frameBufferSize = 64 << 20; + else + frameBufferSize = 128 << 20; + } else if ((info.device_type & INTEL_TYPE_FAMILY_MASK) == INTEL_TYPE_9xx) + frameBufferSize = info.pci->u.h0.base_register_sizes[2]; + + gttSize = frameBufferSize / 1024; + } + // TODO: test with different models! if (info.device_type == (INTEL_TYPE_8xx | INTEL_TYPE_83x)) { @@ -181,10 +220,16 @@ case i855_STOLEN_MEMORY_64M: memorySize *= 64; break; + case i855_STOLEN_MEMORY_128M: + memorySize *= 128; + break; + case i855_STOLEN_MEMORY_256M: + memorySize *= 256; + break; } } - return memorySize; + return memorySize - gttSize - 4096; } @@ -352,7 +397,7 @@ AreaKeeper graphicsMapper; info.graphics_memory_area = graphicsMapper.Map("intel extreme graphics memory", (void *)info.pci->u.h0.base_registers[fbIndex], - totalSize, B_ANY_KERNEL_BLOCK_ADDRESS | B_MTR_WC, + totalSize, B_ANY_KERNEL_BLOCK_ADDRESS /*| B_MTR_WC*/, B_READ_AREA | B_WRITE_AREA, (void **)&info.graphics_memory); if (graphicsMapper.InitCheck() < B_OK) { // try again without write combining @@ -386,26 +431,33 @@ // init graphics memory manager - info.memory_manager = mem_init("intel extreme memory manager", 0, totalSize, 1024, - min_c(totalSize / 1024, 512)); - if (info.memory_manager == NULL) - return B_NO_MEMORY; + AreaKeeper gttMapper; + info.gtt_area = -1; if ((info.device_type & INTEL_TYPE_9xx) != 0) { if ((info.device_type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_965) { info.gtt_base = info.registers + i965_GTT_BASE; info.gtt_size = i965_GTT_SIZE; } else { - // TODO: map it in??? - info.gtt_base = (uint8*)info.pci->u.h0.base_register_sizes[3]; - info.gtt_size = i830_GTT_SIZE; - // TODO: for now... + info.gtt_area = gttMapper.Map("intel extreme gtt", + (void *)info.pci->u.h0.base_registers[3], totalSize / 1024, + B_ANY_KERNEL_ADDRESS, 0, (void **)&info.gtt_base); + if (gttMapper.InitCheck() < B_OK) { + dprintf(DEVICE_NAME ": could not map GTT area!\n"); + return info.gtt_area; + } + info.gtt_size = totalSize / 1024; } } else { info.gtt_base = info.registers + i830_GTT_BASE; info.gtt_size = i830_GTT_SIZE; } + info.memory_manager = mem_init("intel extreme memory manager", 0, totalSize, 1024, + min_c(totalSize / 1024, 512)); + if (info.memory_manager == NULL) + return B_NO_MEMORY; + // reserve ring buffer memory (currently, this memory is placed in // the graphics memory), but this could bring us problems with // write combining... @@ -426,11 +478,23 @@ secondary.base = info.graphics_memory + secondary.offset; } + // Fix some problems on certain chips (taken from X driver) + // 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)); + } else { + dprintf("i965 quirk\n"); + write32(info.registers + 0x6204, (1L << 29) | (1L << 23)); + } + write32(info.registers + 0x7408, 0x10); + // no errors, so keep areas and mappings sharedCreator.Detach(); additionalMemoryCreator.Detach(); graphicsMapper.Detach(); mmioMapper.Detach(); + gttMapper.Detach(); info.shared_info->graphics_memory_area = info.graphics_memory_area; info.shared_info->registers_area = info.registers_area; @@ -463,8 +527,17 @@ // setup overlay registers - info.overlay_registers = (overlay_registers *)((uint8 *)info.shared_info - + ROUND_TO_PAGE_SIZE(sizeof(intel_shared_info))); + if (info.device_type == (INTEL_TYPE_9xx | INTEL_TYPE_G33)) { + if (mem_alloc(info.memory_manager, B_PAGE_SIZE, &info, + &info.overlay_handle, &info.overlay_offset) == B_OK) { + info.overlay_registers = (overlay_registers *)(info.graphics_memory + + info.overlay_offset); + info.shared_info->overlay_offset = info.overlay_offset; + } + } else { + info.overlay_registers = (overlay_registers *)((uint8 *)info.shared_info + + ROUND_TO_PAGE_SIZE(sizeof(intel_shared_info))); + } init_overlay_registers(info.overlay_registers); physical_entry physicalEntry; @@ -474,12 +547,11 @@ // The hardware status page and the cursor memory share one area with // the overlay registers and the shared info - get_memory_map((uint8 *)info.overlay_registers + B_PAGE_SIZE, - B_PAGE_SIZE, &physicalEntry, 1); + uint8 *base = (uint8 *)info.shared_info + ROUND_TO_PAGE_SIZE(sizeof(intel_shared_info)); + get_memory_map(base + B_PAGE_SIZE, B_PAGE_SIZE, &physicalEntry, 1); info.shared_info->physical_status_page = (uint8 *)physicalEntry.address; - get_memory_map((uint8 *)info.overlay_registers + 2 * B_PAGE_SIZE, - B_PAGE_SIZE, &physicalEntry, 1); + get_memory_map(base + 2 * B_PAGE_SIZE, B_PAGE_SIZE, &physicalEntry, 1); info.shared_info->physical_cursor_memory = (uint8 *)physicalEntry.address; // setup the GTT to point to include the additional memory @@ -537,6 +609,7 @@ mem_destroy(info.memory_manager); delete_area(info.graphics_memory_area); + delete_area(info.gtt_area); delete_area(info.registers_area); delete_area(info.shared_area); Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h 2008-01-02 17:33:27 UTC (rev 23219) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h 2008-01-02 18:44:39 UTC (rev 23220) @@ -26,11 +26,14 @@ struct intel_shared_info *shared_info; area_id shared_area; + uint32 overlay_handle; + uint32 overlay_offset; struct overlay_registers *overlay_registers; // update buffer, shares an area with shared_info uint8 *gtt_base; size_t gtt_size; + area_id gtt_area; uint8 *graphics_memory; area_id graphics_memory_area; area_id additional_memory_area; From marcusoverhagen at mail.berlios.de Wed Jan 2 23:02:15 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 2 Jan 2008 23:02:15 +0100 Subject: [Haiku-commits] r23221 - haiku/trunk/src/add-ons/kernel/bus_managers Message-ID: <200801022202.m02M2FoH012041@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-02 23:02:15 +0100 (Wed, 02 Jan 2008) New Revision: 23221 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23221&view=rev Added: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ Log: Restart. Do not pass Go, do not collect 00. From mmu_man at mail.berlios.de Wed Jan 2 23:05:30 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 2 Jan 2008 23:05:30 +0100 Subject: [Haiku-commits] r23222 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801022205.m02M5UAa012223@sheep.berlios.de> Author: mmu_man Date: 2008-01-02 23:05:28 +0100 (Wed, 02 Jan 2008) New Revision: 23222 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23222&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S Modified: haiku/trunk/src/system/boot/platform/atari_m68k/menu.cpp Log: smp ? me no know about smp here... This will be the stage 1 loader... Modified: haiku/trunk/src/system/boot/platform/atari_m68k/menu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/menu.cpp 2008-01-02 22:02:15 UTC (rev 23221) +++ haiku/trunk/src/system/boot/platform/atari_m68k/menu.cpp 2008-01-02 22:05:28 UTC (rev 23222) @@ -28,9 +28,9 @@ item->SetData(B_SAFEMODE_FAIL_SAFE_VIDEO_MODE); item->SetHelpText("The system will use VESA mode and won't try to open any video graphics driver"); +#if 0 smp_add_safemode_menus(menu); -#if 0 menu->AddItem(item = new(nothrow) MenuItem("Don't call the BIOS")); item->SetType(MENU_ITEM_MARKABLE); Added: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-02 22:02:15 UTC (rev 23221) +++ haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-02 22:05:28 UTC (rev 23222) @@ -0,0 +1,66 @@ +/* + * Copyright 2005, Ingo Weinhold, bonefish at users.sf.net. + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT license. + * + * Author: + * Fran?ois Revol, revol at free.fr. + */ + +#define FUNCTION(x) .global x; .type x, at function; x + +/* + * stage1 boot code for TOS for use as boot block of HDD partitions. + * cf. + * http://www.fortunecity.com/skyscraper/apple/308/html/chap3.htm + * http://leonard.oxg.free.fr/articles/multi_atari/multi_atari.html + * http://alive.atari.org/alive10/btmania.php + * + * The offset of the partition in 512 byte blocks must be written at + * position PARTITION_OFFSET_OFFSET (32 bit little endian; makebootable does + * that) or otherwise the code can't find the partition. + * The partition must be a BFS formatted. The file "beos/system/zbeos" + * (the stage 2 boot loader) loaded into memory at 0x1000:0x0000 (linear address + * 0x10000) and entered at 0x:1000:0x0200 with parameters eax - partition offset + * in 512 byte blocks and dl - BIOS ID of the boot drive. + * + * Compile via: + * nasm -f bin -O5 -o stage1.bin stage1.S + */ + +// 1 enabled verbose output +//#define DEBUG 1 + + +#define BOOT_BLOCK_START_ADDRESS 0x7c00 +#define STACK_ADDRESS BOOT_BLOCK_START_ADDRESS +#define READ_BUFFER_STACK STACK_ADDRESS - 0x2000 +#define PARTITION_OFFSET_OFFSET 506 +#define BFS_SUPERBLOCK_OFFSET 512 + + +// BFS definitions + +#define SUPER_BLOCK_MAGIC1 '1SFB' ; nasm reverses '...' consts +#define SUPER_BLOCK_MAGIC2 0xdd121031 +#define SUPER_BLOCK_MAGIC3 0x15b6830e + +#define INODE_MAGIC1 0x3bbe0ad9 + +#define NUM_DIRECT_BLOCKS 12 + +#define S_IFMT 00000170000o +#define S_IFDIR 00000040000o + + +// BIOS calls + + + + + + + rts + + + From axeld at mail.berlios.de Wed Jan 2 23:29:31 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Jan 2008 23:29:31 +0100 Subject: [Haiku-commits] r23223 - haiku/trunk/src/bin/network/netstat Message-ID: <200801022229.m02MTVR9013929@sheep.berlios.de> Author: axeld Date: 2008-01-02 23:29:30 +0100 (Wed, 02 Jan 2008) New Revision: 23223 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23223&view=rev Modified: haiku/trunk/src/bin/network/netstat/netstat.cpp Log: gethostbyaddr() was used incorrectly, found by James Woodcock, thanks! Modified: haiku/trunk/src/bin/network/netstat/netstat.cpp =================================================================== --- haiku/trunk/src/bin/network/netstat/netstat.cpp 2008-01-02 22:05:28 UTC (rev 23222) +++ haiku/trunk/src/bin/network/netstat/netstat.cpp 2008-01-02 22:29:30 UTC (rev 23223) @@ -59,7 +59,8 @@ return; } - hostent* host = gethostbyaddr((const char*)_address, sizeof(sockaddr_in), AF_INET); + hostent* host = gethostbyaddr((const char*)&address.sin_addr, + sizeof(sockaddr_in), AF_INET); servent* service = getservbyport(ntohs(address.sin_port), NULL); const char *hostName; From axeld at pinc-software.de Wed Jan 2 23:32:55 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Wed, 02 Jan 2008 23:32:55 +0100 CET Subject: [Haiku-commits] r23221 - haiku/trunk/src/add-ons/kernel/bus_managers In-Reply-To: <200801022202.m02M2FoH012041@sheep.berlios.de> Message-ID: <45489534845-BeMail@zon> marcusoverhagen at BerliOS wrote: > Added: > haiku/trunk/src/add-ons/kernel/bus_managers/ata/ > Log: > Restart. Do not pass Go, do not collect 00. I don't really think this is necessary, but we'll see how far you got until next week at BG :-) Bye, Axel. From mmu_man at mail.berlios.de Thu Jan 3 00:43:18 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 3 Jan 2008 00:43:18 +0100 Subject: [Haiku-commits] r23224 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801022343.m02NhIbb013334@sheep.berlios.de> Author: mmu_man Date: 2008-01-03 00:43:17 +0100 (Thu, 03 Jan 2008) New Revision: 23224 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23224&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S Log: Note on compiling stage1 Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-02 22:29:30 UTC (rev 23223) +++ haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-02 23:43:17 UTC (rev 23224) @@ -25,7 +25,8 @@ * in 512 byte blocks and dl - BIOS ID of the boot drive. * * Compile via: - * nasm -f bin -O5 -o stage1.bin stage1.S + * generated.m68k/cross-tools/bin/m68k-unknown-haiku-gcc -nostdlib -fpic -c -o stage1.o src/system/boot/platform/atari_m68k/stage1.S + * generated.m68k/cross-tools/bin/m68k-unknown-haiku-objcopy -O binary stage1.o stage1 */ // 1 enabled verbose output From mmu_man at mail.berlios.de Thu Jan 3 01:02:55 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 3 Jan 2008 01:02:55 +0100 Subject: [Haiku-commits] r23225 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801030002.m0302tL2002269@sheep.berlios.de> Author: mmu_man Date: 2008-01-03 01:02:54 +0100 (Thu, 03 Jan 2008) New Revision: 23225 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23225&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S Log: Test code for stage1... Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-02 23:43:17 UTC (rev 23224) +++ haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-03 00:02:54 UTC (rev 23225) @@ -15,7 +15,10 @@ * http://www.fortunecity.com/skyscraper/apple/308/html/chap3.htm * http://leonard.oxg.free.fr/articles/multi_atari/multi_atari.html * http://alive.atari.org/alive10/btmania.php + * gas stuff: + * http://www.gnu.org/software/binutils/manual/gas-2.9.1/html_chapter/as_18.html#SEC214 * + * x86: * The offset of the partition in 512 byte blocks must be written at * position PARTITION_OFFSET_OFFSET (32 bit little endian; makebootable does * that) or otherwise the code can't find the partition. @@ -55,13 +58,23 @@ // BIOS calls +#ifndef _ASSEMBLER +#error plop +#endif +.loop: + move #'.',%d0 + bsr putc + bra .loop + rts - - - +/* prints the char in d0.b to the console */ +putc: + move.w d0,-(%sp) + move.w #2,-(%sp) // DEV_CON + move.w #3,-(%sp) // Bconout + trap #13 + addi #6,%sp rts - - From mmu_man at mail.berlios.de Thu Jan 3 01:18:14 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 3 Jan 2008 01:18:14 +0100 Subject: [Haiku-commits] r23226 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801030018.m030IEFj005814@sheep.berlios.de> Author: mmu_man Date: 2008-01-03 01:18:14 +0100 (Thu, 03 Jan 2008) New Revision: 23226 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23226&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: Allow using defines from .S files Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-03 00:02:54 UTC (rev 23225) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-03 00:18:14 UTC (rev 23226) @@ -21,6 +21,22 @@ #define DEV_IKBD 4 #define DEV_RAW 5 +#define K_RSHIFT 0x01 +#define K_LSHIFT 0x02 +#define K_CTRL 0x04 +#define K_ALT 0x08 +#define K_CAPSLOCK 0x10 +#define K_CLRHOME 0x20 +#define K_INSERT 0x40 + +#define RW_READ 0x00 +#define RW_WRITE 0x01 +#define RW_NOMEDIACH 0x02 +#define RW_NORETRY 0x04 +#define RW_NOTRANSLATE 0x08 + +#ifndef __ASSEMBLER__ + /* * Atari BIOS calls */ @@ -41,20 +57,7 @@ int16 bflags; }; -#define K_RSHIFT 0x01 -#define K_LSHIFT 0x02 -#define K_CTRL 0x04 -#define K_ALT 0x08 -#define K_CAPSLOCK 0x10 -#define K_CLRHOME 0x20 -#define K_INSERT 0x40 -#define RW_READ 0x00 -#define RW_WRITE 0x01 -#define RW_NOMEDIACH 0x02 -#define RW_NORETRY 0x04 -#define RW_NOTRANSLATE 0x08 - //#define Getmpb() bios(0) #define Bconstat(dev) bios(1, (uint16)dev) #define Bconin(dev) bios(2, (uint16)dev) @@ -125,6 +128,8 @@ extern status_t toserror(int32 err); +#endif /* __ASSEMBLER__ */ + #ifdef __cplusplus } #endif From mmu_man at mail.berlios.de Thu Jan 3 01:26:30 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 3 Jan 2008 01:26:30 +0100 Subject: [Haiku-commits] r23227 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801030026.m030QU6V007788@sheep.berlios.de> Author: mmu_man Date: 2008-01-03 01:26:30 +0100 (Thu, 03 Jan 2008) New Revision: 23227 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23227&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S Log: Fixes. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-03 00:18:14 UTC (rev 23226) +++ haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-03 00:26:30 UTC (rev 23227) @@ -32,6 +32,8 @@ * generated.m68k/cross-tools/bin/m68k-unknown-haiku-objcopy -O binary stage1.o stage1 */ +#include "toscalls.h" + // 1 enabled verbose output //#define DEBUG 1 @@ -57,12 +59,7 @@ #define S_IFDIR 00000040000o -// BIOS calls -#ifndef _ASSEMBLER -#error plop -#endif - .loop: move #'.',%d0 bsr putc @@ -71,10 +68,10 @@ /* prints the char in d0.b to the console */ putc: - move.w d0,-(%sp) - move.w #2,-(%sp) // DEV_CON + move.w %d0,-(%sp) + move.w #DEV_CON,-(%sp) // DEV_CON move.w #3,-(%sp) // Bconout trap #13 - addi #6,%sp + add.l #6,%sp rts From mmu_man at mail.berlios.de Thu Jan 3 01:44:41 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 3 Jan 2008 01:44:41 +0100 Subject: [Haiku-commits] r23228 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801030044.m030ifYn008555@sheep.berlios.de> Author: mmu_man Date: 2008-01-03 01:44:41 +0100 (Thu, 03 Jan 2008) New Revision: 23228 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23228&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S Log: Note on adding stage1 to an image. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-03 00:26:30 UTC (rev 23227) +++ haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-03 00:44:41 UTC (rev 23228) @@ -30,6 +30,11 @@ * Compile via: * generated.m68k/cross-tools/bin/m68k-unknown-haiku-gcc -nostdlib -fpic -c -o stage1.o src/system/boot/platform/atari_m68k/stage1.S * generated.m68k/cross-tools/bin/m68k-unknown-haiku-objcopy -O binary stage1.o stage1 + * + * Add to image: + * dd conv=notrunc if=haiku/trunk/stage1 of=em-20-200.swapped.hd bs=1 count=30 + * set bootable: + * echo -en '\x12\x34' | dd conv=notrunc seek=510 bs=1 count=2 of=em-20-200.swapped.hd */ #include "toscalls.h" From jackburton at mail.berlios.de Thu Jan 3 08:30:07 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 3 Jan 2008 08:30:07 +0100 Subject: [Haiku-commits] r23229 - in haiku/trunk: headers/os/interface headers/private/interface src/kits/interface Message-ID: <200801030730.m037U7dS017314@sheep.berlios.de> Author: jackburton Date: 2008-01-03 08:30:05 +0100 (Thu, 03 Jan 2008) New Revision: 23229 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23229&view=rev Modified: haiku/trunk/headers/os/interface/Menu.h haiku/trunk/headers/private/interface/MenuPrivate.h haiku/trunk/headers/private/interface/MenuWindow.h haiku/trunk/src/kits/interface/Menu.cpp haiku/trunk/src/kits/interface/MenuBar.cpp haiku/trunk/src/kits/interface/MenuWindow.cpp Log: Fixed problem with some popup menus (check ticket #1679) Moved GetMouse() calls near the check for exit conditions. Reorganized a bit the code, and hopefully simplified it in some places. Modified: haiku/trunk/headers/os/interface/Menu.h =================================================================== --- haiku/trunk/headers/os/interface/Menu.h 2008-01-03 00:44:41 UTC (rev 23228) +++ haiku/trunk/headers/os/interface/Menu.h 2008-01-03 07:30:05 UTC (rev 23229) @@ -182,8 +182,8 @@ void _UpdateStateOpenSelect(BMenuItem* item, bigtime_t& openTime, bigtime_t& closeTime); - void _UpdateStateClose(BMenuItem* item, - const BPoint& where, const uint32& buttons); + void _UpdateStateClose(BMenuItem* item, const BPoint& where, + const uint32& buttons); bool _AddItem(BMenuItem* item, int32 index); bool _RemoveItems(int32 index, int32 count, Modified: haiku/trunk/headers/private/interface/MenuPrivate.h =================================================================== --- haiku/trunk/headers/private/interface/MenuPrivate.h 2008-01-03 00:44:41 UTC (rev 23228) +++ haiku/trunk/headers/private/interface/MenuPrivate.h 2008-01-03 07:30:05 UTC (rev 23229) @@ -8,8 +8,38 @@ MENU_STATE_CLOSED = 5 }; - extern const char *kEmptyMenuLabel; +// Note: since sqrt is slow, we don't use it and return the square of the distance +#define square(x) ((x) * (x)) +static inline float +point_distance(const BPoint &pointA, const BPoint &pointB) +{ + return square(pointA.x - pointB.x) + square(pointA.y - pointB.y); +} + +/* +static float +point_rect_distance(const BPoint &point, const BRect &rect) +{ + float horizontal = 0; + float vertical = 0; + if (point.x < rect.left) + horizontal = rect.left - point.x; + else if (point.x > rect.right) + horizontal = point.x - rect.right; + + if (point.y < rect.top) + vertical = rect.top - point.y; + else if (point.y > rect.bottom) + vertical = point.y - rect.bottom; + + return square(horizontal) + square(vertical); +} +*/ + +#undef square + + #endif // __MENU_PRIVATE_H Modified: haiku/trunk/headers/private/interface/MenuWindow.h =================================================================== --- haiku/trunk/headers/private/interface/MenuWindow.h 2008-01-03 00:44:41 UTC (rev 23228) +++ haiku/trunk/headers/private/interface/MenuWindow.h 2008-01-03 07:30:05 UTC (rev 23229) @@ -25,6 +25,8 @@ public: BMenuWindow(const char *name); virtual ~BMenuWindow(); + + virtual void DispatchMessage(BMessage *message, BHandler *handler); void AttachMenu(BMenu *menu); void DetachMenu(); Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-03 00:44:41 UTC (rev 23228) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-03 07:30:05 UTC (rev 23229) @@ -1175,7 +1175,6 @@ int action; BMenuItem *menuItem = _Track(&action); - _SetStickyMode(false); fExtraRect = NULL; return menuItem; @@ -1253,7 +1252,7 @@ archive->FindFloat("_maxwidth", &fMaxContentWidth); BMessage msg; - for (int32 i = 0; archive->FindMessage("_items", i, &msg) == B_OK; i++) { + for (int32 i = 0; archive->FindMessage("_items", i, &msg) == B_OK; i++) { BArchivable *object = instantiate_object(&msg); if (BMenuItem *item = dynamic_cast(object)) { BRect bounds; @@ -1367,6 +1366,14 @@ if (fSuper != NULL) fSuper->fState = MENU_STATE_TRACKING_SUBMENU; + BPoint location; + uint32 buttons; + if (LockLooper()) { + GetMouse(&location, &buttons); + UnlockLooper(); + } + + bool releasedOnce = buttons == 0; while (true) { if (_CustomTrackingWantsToQuit()) break; @@ -1374,12 +1381,7 @@ bool locked = LockLooper(); if (!locked) break; - - bigtime_t snoozeAmount = 50000; - BPoint location; - uint32 buttons; - GetMouse(&location, &buttons, true); - + BMenuWindow *window = static_cast(Window()); BPoint screenLocation = ConvertToScreen(location); @@ -1387,8 +1389,11 @@ item = NULL; } else { item = _HitTestItems(location, B_ORIGIN); - if (item != NULL) + if (item != NULL) { _UpdateStateOpenSelect(item, openTime, closeTime); + if (!releasedOnce) + releasedOnce = true; + } } // Track the submenu @@ -1397,58 +1402,58 @@ locked = false; int submenuAction = MENU_STATE_TRACKING; BMenu *submenu = fSelected->Submenu(); - bool wasSticky = _IsStickyMode(); - if (wasSticky) - submenu->_SetStickyMode(true); + submenu->_SetStickyMode(_IsStickyMode()); BMenuItem *submenuItem = submenu->_Track(&submenuAction); - - // check if the user started holding down a mouse button in a submenu - if (wasSticky && !_IsStickyMode()) { - buttons = 1; - // buttons must have been pressed in the meantime - } - if (submenuAction == MENU_STATE_CLOSED) { item = submenuItem; - fState = submenuAction; - break; + fState = MENU_STATE_CLOSED; } - - locked = LockLooper(); - if (!locked) - break; } else if (item == NULL) { - if (_OverSuper(screenLocation)) { + if (_OverSuper(screenLocation)) fState = MENU_STATE_TRACKING; - UnlockLooper(); - break; - } + else { + if (!_OverSubmenu(fSelected, screenLocation) + && system_time() > closeTime + kHysteresis + && fState != MENU_STATE_TRACKING_SUBMENU) { + _SelectItem(NULL); + fState = MENU_STATE_TRACKING; + } - if (!_OverSubmenu(fSelected, screenLocation) - && system_time() > closeTime + kHysteresis - && fState != MENU_STATE_TRACKING_SUBMENU) { - _SelectItem(NULL); - fState = MENU_STATE_TRACKING; + if (fSuper != NULL) { + // Give supermenu the chance to continue tracking + *action = fState; + if (locked) + UnlockLooper(); + return NULL; + } } - - if (fSuper != NULL) { - // Give supermenu the chance to continue tracking - *action = fState; - if (locked) - UnlockLooper(); - - return NULL; - } } - if (locked) + if (!locked) + locked = LockLooper(); + + BPoint newLocation; + uint32 newButtons; + if (locked) { + GetMouse(&newLocation, &newButtons, true); UnlockLooper(); + locked = false; + } - _UpdateStateClose(item, location, buttons); - + if (newLocation != location || newButtons != buttons) { + if (!releasedOnce && newButtons == 0 && buttons != 0) + releasedOnce = true; + location = newLocation; + buttons = newButtons; + } + + if (releasedOnce) + _UpdateStateClose(item, location, buttons); + if (fState == MENU_STATE_CLOSED) break; + bigtime_t snoozeAmount = 50000; snooze(snoozeAmount); } @@ -1460,9 +1465,6 @@ UnlockLooper(); } - if (_IsStickyMode()) - _SetStickyMode(false); - // delete the menu window recycled for all the child menus _DeleteMenuWindow(); @@ -1503,17 +1505,14 @@ if (buttons != 0 && _IsStickyMode()) { if (item == NULL) fState = MENU_STATE_CLOSED; - else { - BMenu *supermenu = Supermenu(); - for(; supermenu; supermenu = supermenu->Supermenu()) - supermenu->_SetStickyMode(false); + else _SetStickyMode(false); - } } else if (buttons == 0 && !_IsStickyMode()) { if (fExtraRect != NULL && fExtraRect->Contains(where)) { _SetStickyMode(true); fExtraRect = NULL; - // This code should be executed only once + // Setting this to NULL will prevent this code + // to be executed next time } else fState = MENU_STATE_CLOSED; } @@ -2159,7 +2158,16 @@ void BMenu::_SetStickyMode(bool on) { - if (fStickyMode != on) { + if (fStickyMode == on) + return; + + fStickyMode = on; + + // If we are switching to sticky mode, propagate the status + // back to the super menu + if (fSuper != NULL) + fSuper->_SetStickyMode(on); + else { // TODO: Ugly hack, but it needs to be done right here in this method BMenuBar *menuBar = dynamic_cast(this); if (on && menuBar != NULL && menuBar->LockLooper()) { @@ -2168,14 +2176,7 @@ menuBar->_StealFocus(); menuBar->UnlockLooper(); } - - fStickyMode = on; } - - // If we are switching to sticky mode, propagate the status - // back to the super menu - if (on && fSuper != NULL) - fSuper->_SetStickyMode(on); } @@ -2222,22 +2223,20 @@ // two runs: first we look out for uppercase letters // TODO: support Unicode characters correctly! - for (uint32 i = 0; (c = title[i]) != '\0'; i++) { if (!IsInsideGlyph(c) && isupper(c) && !triggers.HasTrigger(c)) { index = i; trigger = tolower(c); - return triggers.AddTrigger(c);; + return triggers.AddTrigger(c); } } // then, if we still haven't found anything, we accept them all - index = 0; while ((c = UTF8ToCharCode(&title)) != 0) { if (!isspace(c) && !triggers.HasTrigger(c)) { trigger = tolower(c); - return triggers.AddTrigger(c);; + return triggers.AddTrigger(c); } index++; Modified: haiku/trunk/src/kits/interface/MenuBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuBar.cpp 2008-01-03 00:44:41 UTC (rev 23228) +++ haiku/trunk/src/kits/interface/MenuBar.cpp 2008-01-03 07:30:05 UTC (rev 23229) @@ -446,17 +446,6 @@ } -// Note: since sqrt is slow, we don't use it and return the square of the distance -// TODO: Move this to some common place, could be used in BMenu too. -#define square(x) ((x) * (x)) -static float -point_distance(const BPoint &pointA, const BPoint &pointB) -{ - return square(pointA.x - pointB.x) + square(pointA.y - pointB.y); -} -#undef square - - BMenuItem * BMenuBar::_Track(int32 *action, int32 startIndex, bool showMenu) { @@ -466,24 +455,23 @@ BWindow *window = Window(); fState = MENU_STATE_TRACKING; - if (startIndex != -1) { - be_app->ObscureCursor(); - if (window->Lock()) { + BPoint where; + uint32 buttons; + if (window->Lock()) { + if (startIndex != -1) { + be_app->ObscureCursor(); _SelectItem(ItemAt(startIndex), true, true); - window->Unlock(); } + GetMouse(&where, &buttons); + window->Unlock(); } - + while (true) { bigtime_t snoozeAmount = 40000; bool locked = (Window() != NULL && window->Lock());//WithTimeout(200000) if (!locked) break; - BPoint where; - uint32 buttons; - GetMouse(&where, &buttons, true); - BMenuItem *menuItem = _HitTestItems(where, B_ORIGIN); if (menuItem != NULL) { // Select item if: @@ -520,35 +508,26 @@ locked = false; snoozeAmount = 30000; bool wasSticky = _IsStickyMode(); - if (wasSticky) - menu->_SetStickyMode(true); + menu->_SetStickyMode(wasSticky); int localAction; fChosenItem = menu->_Track(&localAction); - if (menu->State(NULL) == MENU_STATE_TRACKING - && menu->_IsStickyMode()) - menu->_SetStickyMode(false); - // check if the user started holding down a mouse button in a submenu - if (wasSticky && !_IsStickyMode()) { - buttons = 1; - // buttons must have been pressed in the meantime + // The mouse could have meen moved since the last time we + // checked its position, or buttons might have been pressed. + // Unfortunately our child menus don't tell + // us the new position. + // TODO: Maybe have a shared struct between all menus + // where to store the current mouse position ? + // (Or just use the BView mouse hooks) + BPoint newWhere; + if (window->Lock()) { + GetMouse(&newWhere, &buttons); + window->Unlock(); } // This code is needed to make menus // that are children of BMenuFields "sticky" (see ticket #953) if (localAction == MENU_STATE_CLOSED) { - // The mouse could have meen moved since the last time we - // checked its position. Unfortunately our child menus don't tell - // us the new position. - // TODO: Maybe have a shared struct between all menus - // where to store the current mouse position ? - BPoint newWhere; - uint32 newButtons; - if (window->Lock()) { - GetMouse(&newWhere, &newButtons); - window->Unlock(); - } - if (fExtraRect != NULL && fExtraRect->Contains(where) // 9 = 3 pixels ^ 2 (since point_distance() returns the square of the distance) && point_distance(newWhere, where) < 9) { @@ -563,8 +542,14 @@ fState = MENU_STATE_TRACKING; } - if (locked) + if (!locked) + locked = window->Lock(); + + if (locked) { + GetMouse(&where, &buttons, true); window->Unlock(); + locked = false; + } if (fState == MENU_STATE_CLOSED || (buttons != 0 && _IsStickyMode() && menuItem == NULL)) Modified: haiku/trunk/src/kits/interface/MenuWindow.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuWindow.cpp 2008-01-03 00:44:41 UTC (rev 23228) +++ haiku/trunk/src/kits/interface/MenuWindow.cpp 2008-01-03 07:30:05 UTC (rev 23229) @@ -244,6 +244,13 @@ void +BMenuWindow::DispatchMessage(BMessage *message, BHandler *handler) +{ + BWindow::DispatchMessage(message, handler); +} + + +void BMenuWindow::AttachMenu(BMenu *menu) { if (fMenuFrame) From axeld at mail.berlios.de Thu Jan 3 11:13:21 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Jan 2008 11:13:21 +0100 Subject: [Haiku-commits] r23230 - haiku/trunk/src/servers/app Message-ID: <200801031013.m03ADLIO025442@sheep.berlios.de> Author: axeld Date: 2008-01-03 11:13:21 +0100 (Thu, 03 Jan 2008) New Revision: 23230 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23230&view=rev Modified: haiku/trunk/src/servers/app/Desktop.cpp Log: Applied patch by Anthony Lee: the user was attached to the font manager too late, therefore, the DesktopSettings couldn't access user fonts. This fixes bug #1691, thanks! Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2008-01-03 07:30:05 UTC (rev 23229) +++ haiku/trunk/src/servers/app/Desktop.cpp 2008-01-03 10:13:21 UTC (rev 23230) @@ -371,6 +371,8 @@ if (fSharedReadOnlyArea < B_OK) return fSharedReadOnlyArea; + gFontManager->AttachUser(fUserID); + fSettings = new DesktopSettingsPrivate(fServerReadOnlyMemory); for (int32 i = 0; i < kMaxWorkspaces; i++) { @@ -408,8 +410,6 @@ _RebuildClippingForAllWindows(stillAvailableOnScreen); _SetBackground(stillAvailableOnScreen); - gFontManager->AttachUser(fUserID); - SetCursor(NULL); // this will set the default cursor From axeld at mail.berlios.de Thu Jan 3 11:33:04 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Jan 2008 11:33:04 +0100 Subject: [Haiku-commits] r23231 - haiku/trunk/src/system/kernel/slab Message-ID: <200801031033.m03AX4Yg026947@sheep.berlios.de> Author: axeld Date: 2008-01-03 11:33:03 +0100 (Thu, 03 Jan 2008) New Revision: 23231 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23231&view=rev Modified: haiku/trunk/src/system/kernel/slab/Slab.cpp Log: The slab areas shouldn't be user readable... Modified: haiku/trunk/src/system/kernel/slab/Slab.cpp =================================================================== --- haiku/trunk/src/system/kernel/slab/Slab.cpp 2008-01-03 10:13:21 UTC (rev 23230) +++ haiku/trunk/src/system/kernel/slab/Slab.cpp 2008-01-03 10:33:03 UTC (rev 23231) @@ -277,7 +277,7 @@ // so we lock them. when moving the slab to the empty list we should // unlock them, and lock them again when getting one from the empty list. area_id areaId = create_area(cache->name, pages, B_ANY_KERNEL_ADDRESS, - cache->slab_size, lock, B_READ_AREA | B_WRITE_AREA); + cache->slab_size, lock, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); if (areaId < 0) return areaId; From jackburton at mail.berlios.de Thu Jan 3 11:43:45 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 3 Jan 2008 11:43:45 +0100 Subject: [Haiku-commits] r23232 - haiku/trunk/src/kits/interface Message-ID: <200801031043.m03Ahj9t027916@sheep.berlios.de> Author: jackburton Date: 2008-01-03 11:43:45 +0100 (Thu, 03 Jan 2008) New Revision: 23232 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23232&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp Log: There was a reason for this after all: Sometimes hovering from the submenu to the parent didn't trigger tracking from it. Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-03 10:33:03 UTC (rev 23231) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-03 10:43:45 UTC (rev 23232) @@ -1409,8 +1409,11 @@ fState = MENU_STATE_CLOSED; } } else if (item == NULL) { - if (_OverSuper(screenLocation)) + if (_OverSuper(screenLocation)) { fState = MENU_STATE_TRACKING; + UnlockLooper(); + break; + } else { if (!_OverSubmenu(fSelected, screenLocation) && system_time() > closeTime + kHysteresis From jackburton at mail.berlios.de Thu Jan 3 17:09:33 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 3 Jan 2008 17:09:33 +0100 Subject: [Haiku-commits] r23233 - haiku/trunk/src/kits/interface Message-ID: <200801031609.m03G9XwK010099@sheep.berlios.de> Author: jackburton Date: 2008-01-03 17:09:32 +0100 (Thu, 03 Jan 2008) New Revision: 23233 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23233&view=rev Modified: haiku/trunk/src/kits/interface/View.cpp Log: Somehow r23154 reverted r22930... Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2008-01-03 10:43:45 UTC (rev 23232) +++ haiku/trunk/src/kits/interface/View.cpp 2008-01-03 16:09:32 UTC (rev 23233) @@ -1599,6 +1599,7 @@ fOwner->fLink->StartMessage(AS_LAYER_SET_EVENT_MASK); fOwner->fLink->Attach(mask); fOwner->fLink->Attach(options); + fOwner->fLink->Flush(); } return B_OK; From axeld at mail.berlios.de Thu Jan 3 18:54:30 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Jan 2008 18:54:30 +0100 Subject: [Haiku-commits] r23234 - haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169 Message-ID: <200801031754.m03HsURS023279@sheep.berlios.de> Author: axeld Date: 2008-01-03 18:54:29 +0100 (Thu, 03 Jan 2008) New Revision: 23234 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23234&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/driver.c Log: It seems the RTL 8167 chip works with our 8169 driver unchanged, even though I might just got lucky. Modified: haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/driver.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/driver.c 2008-01-03 16:09:32 UTC (rev 23233) +++ haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/driver.c 2008-01-03 17:54:29 UTC (rev 23234) @@ -50,7 +50,7 @@ if (get_module(B_PCI_MODULE_NAME, (module_info **)&pci) < B_OK) return B_ERROR; for (res = B_ERROR, i = 0; pci->get_nth_pci_info(i, &info) == B_OK; i++) { - if (info.vendor_id == 0x10ec && info.device_id == 0x8169) { + if (info.vendor_id == 0x10ec && (info.device_id == 0x8169 || info.device_id == 0x8167)) { res = B_OK; break; } @@ -86,7 +86,7 @@ } for (cards = 0, index = 0; gPci->get_nth_pci_info(index++, item) == B_OK; ) { - if (item->vendor_id == 0x10ec && item->device_id == 0x8169) { + if (item->vendor_id == 0x10ec && (item->device_id == 0x8169 || item->device_id == 0x8167)) { char name[64]; sprintf(name, "net/rtl8169/%d", cards); gDevList[cards] = item; From axeld at mail.berlios.de Thu Jan 3 20:39:35 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Jan 2008 20:39:35 +0100 Subject: [Haiku-commits] r23235 - haiku/trunk/src/kits/network/dns/irs Message-ID: <200801031939.m03JdZwo010573@sheep.berlios.de> Author: axeld Date: 2008-01-03 20:39:35 +0100 (Thu, 03 Jan 2008) New Revision: 23235 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23235&view=rev Modified: haiku/trunk/src/kits/network/dns/irs/lcl_ho.c Log: h_name must be set, or else libnetwork.so will crash when trying to resolve a name... Modified: haiku/trunk/src/kits/network/dns/irs/lcl_ho.c =================================================================== --- haiku/trunk/src/kits/network/dns/irs/lcl_ho.c 2008-01-03 17:54:29 UTC (rev 23234) +++ haiku/trunk/src/kits/network/dns/irs/lcl_ho.c 2008-01-03 19:39:35 UTC (rev 23235) @@ -343,14 +343,14 @@ return (NULL); strcpy(pvt->hostbuf, "localhost"); - pvt->host_aliases[0] = pvt->hostbuf; - pvt->host_aliases[1] = NULL; + pvt->host_aliases[0] = NULL; pvt->h_addr_ptrs[0] = (char *)pvt->host_addr; pvt->h_addr_ptrs[1] = NULL; pvt->host.h_addr_list = pvt->h_addr_ptrs; pvt->host.h_length = INADDRSZ; pvt->host.h_addrtype = AF_INET; pvt->host.h_aliases = pvt->host_aliases; + pvt->host.h_name = pvt->hostbuf; ((struct in_addr *)pvt->host_addr)->s_addr = INADDR_LOOPBACK; pvt->index++; From axeld at mail.berlios.de Thu Jan 3 20:55:20 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Jan 2008 20:55:20 +0100 Subject: [Haiku-commits] r23236 - haiku/trunk/src/add-ons/kernel/network/protocols/tcp Message-ID: <200801031955.m03JtKYC011631@sheep.berlios.de> Author: axeld Date: 2008-01-03 20:55:19 +0100 (Thu, 03 Jan 2008) New Revision: 23236 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23236&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp haiku/trunk/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.h Log: Got rid of DeleteSocket(). Modified: haiku/trunk/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp 2008-01-03 19:39:35 UTC (rev 23235) +++ haiku/trunk/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp 2008-01-03 19:55:19 UTC (rev 23236) @@ -763,14 +763,6 @@ } -void -TCPEndpoint::DeleteSocket() -{ - // the next call will delete `this'. - gSocketModule->delete_socket(socket); -} - - status_t TCPEndpoint::DelayedAcknowledge() { @@ -1887,6 +1879,6 @@ if (mutex_lock(&endpoint->fLock) < B_OK) return; - endpoint->DeleteSocket(); + gSocketModule->delete_socket(endpoint->socket); } Modified: haiku/trunk/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.h 2008-01-03 19:39:35 UTC (rev 23235) +++ haiku/trunk/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.h 2008-01-03 19:55:19 UTC (rev 23236) @@ -72,8 +72,6 @@ tcp_state State() const { return fState; } bool IsBound() const; - void DeleteSocket(); - status_t DelayedAcknowledge(); status_t SendAcknowledge(bool force); status_t UpdateTimeWait(); From fekdahl at gmail.com Thu Jan 3 22:07:13 2008 From: fekdahl at gmail.com (Fredrik Ekdahl) Date: Thu, 03 Jan 2008 22:07:13 +0100 Subject: [Haiku-commits] r23135 - haiku/trunk/src/add-ons/kernel/drivers/network/nforce/dev/nfe In-Reply-To: <200712161942.lBGJgRLL032454@sheep.berlios.de> References: <200712161942.lBGJgRLL032454@sheep.berlios.de> Message-ID: <1199394433.6116.0.camel@ekdahl> s?n 2007-12-16 klockan 20:42 +0100 skrev axeld at BerliOS: > Author: axeld > Date: 2007-12-16 20:42:26 +0100 (Sun, 16 Dec 2007) > New Revision: 23135 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23135&view=rev > > Modified: > haiku/trunk/src/add-ons/kernel/drivers/network/nforce/dev/nfe/glue.c > Log: > Forgot to add the SWI taskqueues - this should fix #1668. > Can the nforce driver be added to the image now? /Fredrik Edkahl From axeld at mail.berlios.de Thu Jan 3 22:15:26 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Jan 2008 22:15:26 +0100 Subject: [Haiku-commits] r23237 - haiku/trunk/build/jam Message-ID: <200801032115.m03LFQNw015992@sheep.berlios.de> Author: axeld Date: 2008-01-03 22:15:25 +0100 (Thu, 03 Jan 2008) New Revision: 23237 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23237&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Added nforce driver to the image. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-01-03 19:55:19 UTC (rev 23236) +++ haiku/trunk/build/jam/HaikuImage 2008-01-03 21:15:25 UTC (rev 23237) @@ -72,7 +72,8 @@ ; BEOS_NETWORK_DEVICES = ethernet loopback ; -BEOS_NETWORK_DATALINK_PROTOCOLS = ethernet_frame arp loopback_frame ipv4_datagram ; +BEOS_NETWORK_DATALINK_PROTOCOLS = ethernet_frame arp loopback_frame + ipv4_datagram ; #BEOS_NETWORK_PPP = ipcp modem pap pppoe ; BEOS_NETWORK_PROTOCOLS = ipv4 tcp udp icmp ; @@ -117,8 +118,9 @@ $(X86_ONLY)s3savage $(X86_ONLY)via vesa #$(X86_ONLY)vmware ; BEOS_ADD_ONS_DRIVERS_MIDI = emuxki ; -BEOS_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com etherpci $(X86_ONLY)ipro1000 $(X86_ONLY)rtl8139 rtl8169 sis900 - $(X86_ONLY)via_rhine wb840 net_stack #vlance +BEOS_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com etherpci $(X86_ONLY)ipro1000 + $(X86_ONLY)rtl8139 rtl8169 sis900 $(X86_ONLY)via_rhine wb840 net_stack + $(X86_ONLY)nforce #vlance $(GPL_ONLY)bcm440x $(GPL_ONLY)bcm570x ; #BEOS_ADD_ONS_DRIVERS_ACPI = $(X86_ONLY)acpi_button ; From axeld at pinc-software.de Thu Jan 3 22:15:44 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 03 Jan 2008 22:15:44 +0100 CET Subject: [Haiku-commits] =?iso-8859-15?q?r23135_-_haiku/trunk/src/add-ons/?= =?iso-8859-15?q?kernel/drivers/network/nforce/dev/nfe?= In-Reply-To: <1199394433.6116.0.camel@ekdahl> Message-ID: <42399770215-BeMail@zon> Fredrik Ekdahl wrote: > Can the nforce driver be added to the image now? Done in r23237. Bye, Axel. From korli at users.berlios.de Fri Jan 4 08:35:02 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Fri, 4 Jan 2008 08:35:02 +0100 Subject: [Haiku-commits] r23202 - haiku/trunk/src/servers/input In-Reply-To: <2458683784-BeMail@zon> References: <200801011442.m01EgReo032560@sheep.berlios.de> <2458683784-BeMail@zon> Message-ID: 2008/1/1, Axel D?rfler : > jackburton at BerliOS wrote: > > + else > > + memset(fIcon, 0x1d, 16*16*1); > > Is that by any chance B_TRANSPARENT_8_BIT? If so, I would prefer to use > the constant instead. > It's not. Bye, J?r?me From axeld at mail.berlios.de Fri Jan 4 12:40:58 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Jan 2008 12:40:58 +0100 Subject: [Haiku-commits] r23238 - haiku/trunk/src/apps/sudoku Message-ID: <200801041140.m04Bewdd001618@sheep.berlios.de> Author: axeld Date: 2008-01-04 12:40:56 +0100 (Fri, 04 Jan 2008) New Revision: 23238 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23238&view=rev Modified: haiku/trunk/src/apps/sudoku/ProgressWindow.cpp Log: The ProgressWindow also need to adopt the workspaces from the reference window. Modified: haiku/trunk/src/apps/sudoku/ProgressWindow.cpp =================================================================== --- haiku/trunk/src/apps/sudoku/ProgressWindow.cpp 2008-01-03 21:15:25 UTC (rev 23237) +++ haiku/trunk/src/apps/sudoku/ProgressWindow.cpp 2008-01-04 11:40:56 UTC (rev 23238) @@ -79,8 +79,12 @@ ProgressWindow::Start(BWindow* referenceWindow) { BAutolock _(this); + _Center(referenceWindow); + if (referenceWindow != NULL) + SetWorkspaces(referenceWindow->Workspaces()); + fRetrievedUpdate = false; fRetrievedShow = false; delete fRunner; From axeld at mail.berlios.de Fri Jan 4 14:03:37 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Jan 2008 14:03:37 +0100 Subject: [Haiku-commits] r23239 - haiku/trunk/src/kits/app Message-ID: <200801041303.m04D3b7Y003323@sheep.berlios.de> Author: axeld Date: 2008-01-04 14:03:37 +0100 (Fri, 04 Jan 2008) New Revision: 23239 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23239&view=rev Modified: haiku/trunk/src/kits/app/Application.cpp Log: * ResolveSpecifier() used the window's handler name instead of its title for the "Window" B_NAME_SPECIFIER. This should fix bug #1681. * Improved ResolveSpecifier() code. * Minor cleanup. Modified: haiku/trunk/src/kits/app/Application.cpp =================================================================== --- haiku/trunk/src/kits/app/Application.cpp 2008-01-04 11:40:56 UTC (rev 23238) +++ haiku/trunk/src/kits/app/Application.cpp 2008-01-04 13:03:37 UTC (rev 23239) @@ -51,12 +51,21 @@ BLocker BApplication::sAppResourcesLock("_app_resources_lock"); +enum { + kWindowByIndex, + kWindowByName, + kLooperByIndex, + kLooperByID, + kLooperByName, + kApplication +}; + static property_info sPropertyInfo[] = { { "Window", {}, {B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER}, - NULL, 0, + NULL, kWindowByIndex, {}, {}, {} @@ -65,7 +74,7 @@ "Window", {}, {B_NAME_SPECIFIER}, - NULL, 1, + NULL, kWindowByName, {}, {}, {} @@ -74,7 +83,7 @@ "Looper", {}, {B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER}, - NULL, 2, + NULL, kLooperByIndex, {}, {}, {} @@ -83,7 +92,7 @@ "Looper", {}, {B_ID_SPECIFIER}, - NULL, 3, + NULL, kLooperByID, {}, {}, {} @@ -92,7 +101,7 @@ "Looper", {}, {B_NAME_SPECIFIER}, - NULL, 4, + NULL, kLooperByName, {}, {}, {} @@ -101,7 +110,7 @@ "Name", {B_GET_PROPERTY}, {B_DIRECT_SPECIFIER}, - NULL, 5, + NULL, kApplication, {B_STRING_TYPE}, {}, {} @@ -110,7 +119,7 @@ "Window", {B_COUNT_PROPERTIES}, {B_DIRECT_SPECIFIER}, - NULL, 5, + NULL, kApplication, {B_INT32_TYPE}, {}, {} @@ -119,7 +128,7 @@ "Loopers", {B_GET_PROPERTY}, {B_DIRECT_SPECIFIER}, - NULL, 5, + NULL, kApplication, {B_MESSENGER_TYPE}, {}, {} @@ -128,7 +137,7 @@ "Windows", {B_GET_PROPERTY}, {B_DIRECT_SPECIFIER}, - NULL, 5, + NULL, kApplication, {B_MESSENGER_TYPE}, {}, {} @@ -137,7 +146,7 @@ "Looper", {B_COUNT_PROPERTIES}, {B_DIRECT_SPECIFIER}, - NULL, 5, + NULL, kApplication, {B_INT32_TYPE}, {}, {} @@ -622,105 +631,114 @@ BHandler * BApplication::ResolveSpecifier(BMessage *message, int32 index, - BMessage *specifier, int32 what, const char *property) + BMessage *specifier, int32 what, const char *property) { BPropertyInfo propInfo(sPropertyInfo); status_t err = B_OK; uint32 data; - - if (propInfo.FindMatch(message, 0, specifier, what, property, &data) >=0) { + + if (propInfo.FindMatch(message, 0, specifier, what, property, &data) >= 0) { switch (data) { - case 0: { - int32 ind = -1; - err = specifier->FindInt32("index", &ind); + case kWindowByIndex: + { + int32 index; + err = specifier->FindInt32("index", &index); if (err != B_OK) break; + if (what == B_REVERSE_INDEX_SPECIFIER) - ind = CountWindows() - ind; - err = B_BAD_INDEX; - BWindow *win = WindowAt(ind); - if (win) { - if (index <= 0 && message->what == B_GET_PROPERTY) - return this; + index = CountWindows() - index; + + BWindow *window = WindowAt(index); + if (window != NULL) { message->PopSpecifier(); - BMessenger(win).SendMessage(message); - return NULL; - } + BMessenger(window).SendMessage(message); + } else + err = B_BAD_INDEX; break; } - case 1: { + + case kWindowByName: + { const char *name; err = specifier->FindString("name", &name); if (err != B_OK) break; - err = B_NAME_NOT_FOUND; - for (int32 i=0; iName() && strlen(win->Name()) == strlen(name) - && !strcmp(win->Name(), name)) { - if (index <= 0 && message->what == B_GET_PROPERTY) - return this; - message->PopSpecifier(); - BMessenger(win).SendMessage(message); - return NULL; + + for (int32 i = 0;; i++) { + BWindow *window = WindowAt(i); + if (window == NULL) { + err = B_NAME_NOT_FOUND; + break; } + if (window->Title() != NULL && !strcmp(window->Title(), name)) { + message->PopSpecifier(); + BMessenger(window).SendMessage(message); + break; + } } break; } - case 2: { - int32 ind = -1; - err = specifier->FindInt32("index", &ind); + + case kLooperByIndex: + { + int32 index; + err = specifier->FindInt32("index", &index); if (err != B_OK) break; + if (what == B_REVERSE_INDEX_SPECIFIER) - ind = CountLoopers() - ind; - err = B_BAD_INDEX; - BLooper *looper = LooperAt(ind); - if (looper) { - if (index <= 0) - return this; + index = CountLoopers() - index; + + BLooper *looper = LooperAt(index); + if (looper != NULL) { message->PopSpecifier(); BMessenger(looper).SendMessage(message); - return NULL; - } + } else + err = B_BAD_INDEX; break; } - case 3: - //if (index == 0) - // return this; - + + case kLooperByID: + // TODO: implement getting looper by ID! break; - case 4: { + + case kLooperByName: + { const char *name; err = specifier->FindString("name", &name); if (err != B_OK) break; - err = B_NAME_NOT_FOUND; - for (int32 i=0; iName() && strlen(looper->Name()) == strlen(name) - && !strcmp(looper->Name(), name)) { - if (index <= 0) - return this; + if (looper == NULL) { + err = B_NAME_NOT_FOUND; + break; + } + if (looper->Name() != NULL && !strcmp(looper->Name(), name)) { message->PopSpecifier(); BMessenger(looper).SendMessage(message); - return NULL; + break; } } break; } - case 5: + + case kApplication: return this; } } else { - return BLooper::ResolveSpecifier(message, index, specifier, what, - property); + return BLooper::ResolveSpecifier(message, index, specifier, what, + property); } - BMessage reply(B_MESSAGE_NOT_UNDERSTOOD); - reply.AddInt32("error", err); - reply.AddString("message", strerror(err)); - message->SendReply(&reply); + if (err != B_OK) { + BMessage reply(B_MESSAGE_NOT_UNDERSTOOD); + reply.AddInt32("error", err); + reply.AddString("message", strerror(err)); + message->SendReply(&reply); + } return NULL; From korli at mail.berlios.de Fri Jan 4 14:40:07 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Fri, 4 Jan 2008 14:40:07 +0100 Subject: [Haiku-commits] r23240 - haiku/trunk/src/servers/input Message-ID: <200801041340.m04De7TP005151@sheep.berlios.de> Author: korli Date: 2008-01-04 14:40:06 +0100 (Fri, 04 Jan 2008) New Revision: 23240 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23240&view=rev Modified: haiku/trunk/src/servers/input/AddOnManager.cpp Log: added an error message when no replicant can be found Modified: haiku/trunk/src/servers/input/AddOnManager.cpp =================================================================== --- haiku/trunk/src/servers/input/AddOnManager.cpp 2008-01-04 13:03:37 UTC (rev 23239) +++ haiku/trunk/src/servers/input/AddOnManager.cpp 2008-01-04 13:40:06 UTC (rev 23240) @@ -520,10 +520,14 @@ if (replicant.FindMessenger("result", &result) == B_OK) { gInputServer->SetMethodReplicant(new BMessenger(result)); } - } + } } } } + + if (!gInputServer->MethodReplicant()) { + fprintf(stderr, "LoadReplicant(): Method replicant not found!\n"); + } } From axeld at mail.berlios.de Fri Jan 4 17:59:31 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Jan 2008 17:59:31 +0100 Subject: [Haiku-commits] r23241 - haiku/trunk/src/system/kernel Message-ID: <200801041659.m04GxVDn012923@sheep.berlios.de> Author: axeld Date: 2008-01-04 17:59:30 +0100 (Fri, 04 Jan 2008) New Revision: 23241 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23241&view=rev Modified: haiku/trunk/src/system/kernel/elf.cpp Log: Minor cleanup. Modified: haiku/trunk/src/system/kernel/elf.cpp =================================================================== --- haiku/trunk/src/system/kernel/elf.cpp 2008-01-04 13:40:06 UTC (rev 23240) +++ haiku/trunk/src/system/kernel/elf.cpp 2008-01-04 16:59:30 UTC (rev 23241) @@ -381,7 +381,7 @@ kprintf(" rela_len 0x%x\n", image->rela_len); kprintf(" pltrel %p\n", image->pltrel); kprintf(" pltrel_len 0x%x\n", image->pltrel_len); - + kprintf(" debug_symbols %p (%ld)\n", image->debug_symbols, image->num_debug_symbols); } @@ -1256,15 +1256,19 @@ image->elf_header = elfHeader; image->name = strdup(path); - programHeaders = (struct Elf32_Phdr *)malloc(elfHeader->e_phnum * elfHeader->e_phentsize); + programHeaders = (struct Elf32_Phdr *)malloc(elfHeader->e_phnum + * elfHeader->e_phentsize); if (programHeaders == NULL) { dprintf("%s: error allocating space for program headers\n", fileName); status = B_NO_MEMORY; goto error2; } - TRACE(("reading in program headers at 0x%lx, length 0x%x\n", elfHeader->e_phoff, elfHeader->e_phnum * elfHeader->e_phentsize)); - length = _kern_read(fd, elfHeader->e_phoff, programHeaders, elfHeader->e_phnum * elfHeader->e_phentsize); + TRACE(("reading in program headers at 0x%lx, length 0x%x\n", + elfHeader->e_phoff, elfHeader->e_phnum * elfHeader->e_phentsize)); + + length = _kern_read(fd, elfHeader->e_phoff, programHeaders, + elfHeader->e_phnum * elfHeader->e_phentsize); if (length < B_OK) { status = length; TRACE(("%s: error reading in program headers\n", fileName)); @@ -1287,9 +1291,11 @@ if (programHeaders[i].p_type != PT_LOAD) continue; - length += ROUNDUP(programHeaders[i].p_memsz + (programHeaders[i].p_vaddr % B_PAGE_SIZE), B_PAGE_SIZE); + length += ROUNDUP(programHeaders[i].p_memsz + + (programHeaders[i].p_vaddr % B_PAGE_SIZE), B_PAGE_SIZE); - end = ROUNDUP(programHeaders[i].p_memsz + programHeaders[i].p_vaddr, B_PAGE_SIZE); + end = ROUNDUP(programHeaders[i].p_memsz + programHeaders[i].p_vaddr, + B_PAGE_SIZE); if (end > reservedSize) reservedSize = end; } @@ -1303,8 +1309,10 @@ // reserve that space and allocate the areas from that one if (vm_reserve_address_range(vm_kernel_address_space_id(), &reservedAddress, - B_ANY_KERNEL_ADDRESS, reservedSize, 0) < B_OK) + B_ANY_KERNEL_ADDRESS, reservedSize, 0) < B_OK) { + status = B_NO_MEMORY; goto error3; + } start = (addr_t)reservedAddress; image->data_region.size = 0; @@ -1323,7 +1331,8 @@ image->dynamic_section = programHeaders[i].p_vaddr; continue; default: - dprintf("%s: unhandled pheader type 0x%lx\n", fileName, programHeaders[i].p_type); + dprintf("%s: unhandled pheader type 0x%lx\n", fileName, + programHeaders[i].p_type); continue; } @@ -1352,13 +1361,16 @@ continue; } - region->start = (addr_t)reservedAddress + ROUNDOWN(programHeaders[i].p_vaddr, B_PAGE_SIZE); + region->start = (addr_t)reservedAddress + ROUNDOWN( + programHeaders[i].p_vaddr, B_PAGE_SIZE); region->size = ROUNDUP(programHeaders[i].p_memsz + (programHeaders[i].p_vaddr % B_PAGE_SIZE), B_PAGE_SIZE); - region->id = create_area(regionName, (void **)®ion->start, B_EXACT_ADDRESS, - region->size, B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); + region->id = create_area(regionName, (void **)®ion->start, + B_EXACT_ADDRESS, region->size, B_FULL_LOCK, + B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); if (region->id < B_OK) { - dprintf("%s: error allocating area: %s\n", fileName, strerror(region->id)); + dprintf("%s: error allocating area: %s\n", fileName, + strerror(region->id)); status = B_NOT_AN_EXECUTABLE; goto error4; } @@ -1404,11 +1416,13 @@ // We needed to read in the contents of the "text" area, but // now we can protect it read-only/execute - set_area_protection(image->text_region.id, B_KERNEL_READ_AREA | B_KERNEL_EXECUTE_AREA); + set_area_protection(image->text_region.id, + B_KERNEL_READ_AREA | B_KERNEL_EXECUTE_AREA); // There might be a hole between the two segments, and we don't need to // reserve this any longer - vm_unreserve_address_range(vm_kernel_address_space_id(), reservedAddress, reservedSize); + vm_unreserve_address_range(vm_kernel_address_space_id(), reservedAddress, + reservedSize); // ToDo: this should be enabled by kernel settings! if (1) @@ -1427,7 +1441,8 @@ delete_area(image->data_region.id); delete_area(image->text_region.id); error4: - vm_unreserve_address_range(vm_kernel_address_space_id(), reservedAddress, reservedSize); + vm_unreserve_address_range(vm_kernel_address_space_id(), reservedAddress, + reservedSize); error3: free(programHeaders); error2: @@ -1437,6 +1452,9 @@ error: mutex_unlock(&sImageLoadMutex); error0: + dprintf("Could not load kernel add-on \"%s\": %s\n", path, + strerror(status)); + if (vnode) vfs_put_vnode(vnode); _kern_close(fd); From axeld at mail.berlios.de Fri Jan 4 18:12:11 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Jan 2008 18:12:11 +0100 Subject: [Haiku-commits] r23242 - haiku/trunk/src/apps/expander Message-ID: <200801041712.m04HCBcC013950@sheep.berlios.de> Author: axeld Date: 2008-01-04 18:12:11 +0100 (Fri, 04 Jan 2008) New Revision: 23242 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23242&view=rev Modified: haiku/trunk/src/apps/expander/ExpanderRules.cpp Log: Applied patch by Fredrik Ekdahl, this fixes bug #1695. Modified: haiku/trunk/src/apps/expander/ExpanderRules.cpp =================================================================== --- haiku/trunk/src/apps/expander/ExpanderRules.cpp 2008-01-04 16:59:30 UTC (rev 23241) +++ haiku/trunk/src/apps/expander/ExpanderRules.cpp 2008-01-04 17:12:11 UTC (rev 23242) @@ -38,10 +38,10 @@ ExpanderRules::ExpanderRules() { - fList.AddItem(new ExpanderRule("", ".tar.gz", "zcat %s | tar -tvf -", "zcat %s | tar -xf -")); - fList.AddItem(new ExpanderRule("", ".tar.bz2", "bzcat %s | tar -tvf -", "bzcat %s | tar -xf -")); - fList.AddItem(new ExpanderRule("", ".tar.Z", "zcat %s | tar -tvf -", "zcat %s | tar -xf -")); - fList.AddItem(new ExpanderRule("", ".tgz", "zcat %s | tar -tvf -", "zcat %s | tar -xf -")); + fList.AddItem(new ExpanderRule("", ".tar.gz", "tar -ztvf %s", "tar -zxf %s")); + fList.AddItem(new ExpanderRule("", ".tar.bz2", "tar -jtvf %s", "tar -jxf %s")); + fList.AddItem(new ExpanderRule("", ".tar.Z", "tar -Ztvf %s", "tar -Zxf %s")); + fList.AddItem(new ExpanderRule("", ".tgz", "tar -ztvf %s", "tar -zxf %s")); fList.AddItem(new ExpanderRule("application/x-tar", ".tar", "tar -tvf %s", "tar -xf %s")); fList.AddItem(new ExpanderRule("application/x-gzip", ".gz", "echo %s | sed 's/.gz$//g'", "gunzip %s")); fList.AddItem(new ExpanderRule("application/x-bzip2", ".bz2", "echo %s | sed 's/.bz2$//g'", "bunzip2 %s")); From axeld at mail.berlios.de Fri Jan 4 18:14:56 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Jan 2008 18:14:56 +0100 Subject: [Haiku-commits] r23243 - haiku/branches/developer/axeld Message-ID: <200801041714.m04HEusk014123@sheep.berlios.de> Author: axeld Date: 2008-01-04 18:14:55 +0100 (Fri, 04 Jan 2008) New Revision: 23243 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23243&view=rev Added: haiku/branches/developer/axeld/slab_heap/ Log: Started branch to get rid of our current heap implementation. From axeld at mail.berlios.de Fri Jan 4 18:17:05 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Jan 2008 18:17:05 +0100 Subject: [Haiku-commits] r23244 - haiku/branches/developer/axeld/slab_heap Message-ID: <200801041717.m04HH54N014350@sheep.berlios.de> Author: axeld Date: 2008-01-04 18:17:04 +0100 (Fri, 04 Jan 2008) New Revision: 23244 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23244&view=rev Added: haiku/branches/developer/axeld/slab_heap/headers_private_kernel/ Log: Copied trunk's headers/private/kernel to branch. Copied: haiku/branches/developer/axeld/slab_heap/headers_private_kernel (from rev 23243, haiku/trunk/headers/private/kernel) From axeld at mail.berlios.de Fri Jan 4 18:18:34 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Jan 2008 18:18:34 +0100 Subject: [Haiku-commits] r23245 - haiku/branches/developer/axeld/slab_heap Message-ID: <200801041718.m04HIYXl014443@sheep.berlios.de> Author: axeld Date: 2008-01-04 18:18:34 +0100 (Fri, 04 Jan 2008) New Revision: 23245 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23245&view=rev Added: haiku/branches/developer/axeld/slab_heap/src_system_kernel/ Log: Copied trunk's src/system/kernel to branch. Copied: haiku/branches/developer/axeld/slab_heap/src_system_kernel (from rev 23244, haiku/trunk/src/system/kernel) From axeld at mail.berlios.de Fri Jan 4 18:22:52 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Jan 2008 18:22:52 +0100 Subject: [Haiku-commits] r23246 - in haiku/branches/developer/axeld/slab_heap: headers_private_kernel headers_private_kernel/slab headers_private_kernel/util src_system_kernel src_system_kernel/arch/x86 src_system_kernel/slab src_system_kernel/util src_system_kernel/vm Message-ID: <200801041722.m04HMqEY014862@sheep.berlios.de> Author: axeld Date: 2008-01-04 18:22:51 +0100 (Fri, 04 Jan 2008) New Revision: 23246 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23246&view=rev Modified: haiku/branches/developer/axeld/slab_heap/headers_private_kernel/memheap.h haiku/branches/developer/axeld/slab_heap/headers_private_kernel/slab/Slab.h haiku/branches/developer/axeld/slab_heap/headers_private_kernel/util/khash.h haiku/branches/developer/axeld/slab_heap/headers_private_kernel/vm_cache.h haiku/branches/developer/axeld/slab_heap/src_system_kernel/arch/x86/arch_vm_translation_map.cpp haiku/branches/developer/axeld/slab_heap/src_system_kernel/heap.c haiku/branches/developer/axeld/slab_heap/src_system_kernel/slab/Slab.cpp haiku/branches/developer/axeld/slab_heap/src_system_kernel/slab/allocator.cpp haiku/branches/developer/axeld/slab_heap/src_system_kernel/slab/slab_private.h haiku/branches/developer/axeld/slab_heap/src_system_kernel/util/khash.c haiku/branches/developer/axeld/slab_heap/src_system_kernel/vm/vm.cpp haiku/branches/developer/axeld/slab_heap/src_system_kernel/vm/vm_address_space.cpp haiku/branches/developer/axeld/slab_heap/src_system_kernel/vm/vm_cache.cpp Log: Work in progress, so that I can continue with this at a later point, and still be able to test Haiku (this currently crashes very early in the boot process). Modified: haiku/branches/developer/axeld/slab_heap/headers_private_kernel/memheap.h =================================================================== --- haiku/branches/developer/axeld/slab_heap/headers_private_kernel/memheap.h 2008-01-04 17:18:34 UTC (rev 23245) +++ haiku/branches/developer/axeld/slab_heap/headers_private_kernel/memheap.h 2008-01-04 17:22:51 UTC (rev 23246) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2002-2007, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -22,6 +22,9 @@ extern "C" { #endif +void *malloc_early(struct kernel_args *args, size_t size, size_t *_areaSize); +void malloc_early_create_area(void *address, const char *name); + void *memalign(size_t alignment, size_t size); status_t heap_init(addr_t heapBase, size_t heapSize); Modified: haiku/branches/developer/axeld/slab_heap/headers_private_kernel/slab/Slab.h =================================================================== --- haiku/branches/developer/axeld/slab_heap/headers_private_kernel/slab/Slab.h 2008-01-04 17:18:34 UTC (rev 23245) +++ haiku/branches/developer/axeld/slab_heap/headers_private_kernel/slab/Slab.h 2008-01-04 17:22:51 UTC (rev 23246) @@ -20,9 +20,6 @@ /* object_cache_alloc flags */ CACHE_DONT_SLEEP = 1 << 8, - - /* internal */ - CACHE_DURING_BOOT = 1 << 31 }; typedef struct object_cache object_cache; Modified: haiku/branches/developer/axeld/slab_heap/headers_private_kernel/util/khash.h =================================================================== --- haiku/branches/developer/axeld/slab_heap/headers_private_kernel/util/khash.h 2008-01-04 17:18:34 UTC (rev 23245) +++ haiku/branches/developer/axeld/slab_heap/headers_private_kernel/util/khash.h 2008-01-04 17:22:51 UTC (rev 23246) @@ -24,10 +24,13 @@ extern "C" { #endif -struct hash_table *hash_init(uint32 table_size, int next_ptr_offset, - int compare_func(void *element, const void *key), - uint32 hash_func(void *element, const void *key, uint32 range)); -int hash_uninit(struct hash_table *table); +struct hash_table *hash_init_etc(void *table, uint32 tableSize, + uint32 nextOffset, int compareFunc(void *e, const void *key), + uint32 hashFunc(void *e, const void *key, uint32 range)); +struct hash_table *hash_init(uint32 tableSize, uint32 nextOffset, + int compareFunc(void *element, const void *key), + uint32 hashFunc(void *element, const void *key, uint32 range)); +void hash_uninit(struct hash_table *table); status_t hash_grow(struct hash_table *table, uint32 newSize); status_t hash_insert(struct hash_table *table, void *_element); status_t hash_remove(struct hash_table *table, void *_element); @@ -41,6 +44,7 @@ void hash_rewind(struct hash_table *table, struct hash_iterator *i); uint32 hash_count_elements(struct hash_table *table); uint32 hash_count_used_slots(struct hash_table *table); +uint32 get_prime_table_size(uint32 size); /* function pointers must look like this: * Modified: haiku/branches/developer/axeld/slab_heap/headers_private_kernel/vm_cache.h =================================================================== --- haiku/branches/developer/axeld/slab_heap/headers_private_kernel/vm_cache.h 2008-01-04 17:18:34 UTC (rev 23245) +++ haiku/branches/developer/axeld/slab_heap/headers_private_kernel/vm_cache.h 2008-01-04 17:22:51 UTC (rev 23246) @@ -22,7 +22,7 @@ extern "C" { #endif -status_t vm_cache_init(struct kernel_args *args); +status_t vm_cache_init(struct kernel_args *args, void *table, uint32 tableSize); struct vm_cache *vm_cache_create(struct vm_store *store); void vm_cache_acquire_ref(struct vm_cache *cache); void vm_cache_release_ref(struct vm_cache *cache); Modified: haiku/branches/developer/axeld/slab_heap/src_system_kernel/arch/x86/arch_vm_translation_map.cpp =================================================================== --- haiku/branches/developer/axeld/slab_heap/src_system_kernel/arch/x86/arch_vm_translation_map.cpp 2008-01-04 17:18:34 UTC (rev 23245) +++ haiku/branches/developer/axeld/slab_heap/src_system_kernel/arch/x86/arch_vm_translation_map.cpp 2008-01-04 17:22:51 UTC (rev 23246) @@ -784,14 +784,17 @@ return map->lock.sem; } - map->arch_data = (vm_translation_map_arch_info *)malloc(sizeof(vm_translation_map_arch_info)); +dprintf("aa+++\n"); + map->arch_data = (vm_translation_map_arch_info *)malloc( + sizeof(vm_translation_map_arch_info)); +dprintf("aa---\n"); if (map == NULL) { recursive_lock_destroy(&map->lock); return B_NO_MEMORY; } map->arch_data->num_invalidate_pages = 0; - +dprintf("bb\n"); if (!kernel) { // user // allocate a pgdir @@ -810,11 +813,13 @@ map->arch_data->pgdir_virt = sKernelVirtualPageDirectory; map->arch_data->pgdir_phys = sKernelPhysicalPageDirectory; } +dprintf("cc\n"); // zero out the bottom portion of the new pgdir memset(map->arch_data->pgdir_virt + FIRST_USER_PGDIR_ENT, 0, NUM_USER_PGDIR_ENTS * sizeof(page_directory_entry)); +dprintf("dd\n"); // insert this new map into the map list { int state = disable_interrupts(); @@ -831,6 +836,7 @@ release_spinlock(&tmap_list_lock); restore_interrupts(state); } +dprintf("ee\n"); return B_OK; } Modified: haiku/branches/developer/axeld/slab_heap/src_system_kernel/heap.c =================================================================== --- haiku/branches/developer/axeld/slab_heap/src_system_kernel/heap.c 2008-01-04 17:18:34 UTC (rev 23245) +++ haiku/branches/developer/axeld/slab_heap/src_system_kernel/heap.c 2008-01-04 17:22:51 UTC (rev 23246) @@ -421,7 +421,7 @@ // #pragma mark - - +#if 0 void * memalign(size_t alignment, size_t size) { @@ -762,4 +762,4 @@ return address; } - +#endif Modified: haiku/branches/developer/axeld/slab_heap/src_system_kernel/slab/Slab.cpp =================================================================== --- haiku/branches/developer/axeld/slab_heap/src_system_kernel/slab/Slab.cpp 2008-01-04 17:18:34 UTC (rev 23245) +++ haiku/branches/developer/axeld/slab_heap/src_system_kernel/slab/Slab.cpp 2008-01-04 17:22:51 UTC (rev 23246) @@ -1,9 +1,6 @@ /* * Copyright 2007, Hugo Santos. All Rights Reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Hugo Santos, hugosantos at gmail.com */ @@ -30,7 +27,7 @@ // TODO kMagazineCapacity should be dynamically tuned per cache. -//#define TRACE_SLAB +#define TRACE_SLAB #ifdef TRACE_SLAB #define TRACE_CACHE(cache, format, args...) \ @@ -73,10 +70,6 @@ object_cache_destructor destructor; object_cache_reclaimer reclaimer; - status_t (*allocate_pages)(object_cache *cache, void **pages, - uint32 flags); - void (*free_pages)(object_cache *cache, void *pages); - object_depot depot; virtual slab *CreateSlab(uint32 flags) = 0; @@ -100,7 +93,6 @@ slab *ObjectSlab(void *object) const; }; - struct HashedObjectCache : object_cache { struct Link : HashTableLink { const void *buffer; @@ -144,14 +136,12 @@ size_t lower_boundary; }; - struct depot_magazine { struct depot_magazine *next; uint16 current_round, round_count; void *rounds[0]; }; - struct depot_cpu_store { benaphore lock; struct depot_magazine *loaded, *previous; @@ -163,6 +153,7 @@ static uint8 *sInitialBegin, *sInitialLimit, *sInitialPointer; static kernel_args *sKernelArgs; +static bool sDuringBoot = true; static status_t object_cache_reserve_internal(object_cache *cache, @@ -226,7 +217,8 @@ static void * internal_alloc(size_t size, uint32 flags) { - if (flags & CACHE_DURING_BOOT) { +dprintf("internal alloc size %lu, flags %lx\n", size, flags); + if (sDuringBoot) { if ((sInitialPointer + size) > sInitialLimit) panic("internal_alloc: ran out of initial space"); @@ -235,7 +227,7 @@ return buffer; } - return block_alloc(size); + return malloc/*block_alloc*/(size); } @@ -247,14 +239,14 @@ if (buffer >= sInitialBegin && buffer < sInitialLimit) return; - block_free(buffer); + /*block_*/free(buffer); } static status_t benaphore_boot_init(benaphore *lock, const char *name, uint32 flags) { - if (flags & CACHE_DURING_BOOT) { + if (sDuringBoot) { lock->sem = -1; lock->count = 1; return B_OK; @@ -265,10 +257,21 @@ static status_t -area_allocate_pages(object_cache *cache, void **pages, uint32 flags) +allocate_pages(object_cache *cache, void **pages, uint32 flags) { TRACE_CACHE(cache, "allocate pages (%lu, 0x0%lx)", cache->slab_size, flags); + if (sDuringBoot) { + addr_t base = vm_allocate_early(sKernelArgs, cache->slab_size, + cache->slab_size, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); + + *pages = (void *)base; + cache->usage += cache->slab_size; + + TRACE_CACHE(cache, " ... = { %p }", *pages); + return B_OK; + } + uint32 lock = B_FULL_LOCK; if (cache->flags & CACHE_UNLOCKED_PAGES) lock = B_NO_LOCK; @@ -284,14 +287,16 @@ cache->usage += cache->slab_size; TRACE_CACHE(cache, " ... = { %ld, %p }", areaId, *pages); - return B_OK; } static void -area_free_pages(object_cache *cache, void *pages) +free_pages(object_cache *cache, void *pages) { + if (sDuringBoot) + panic("memory pressure on bootup?"); + area_id id = area_for(pages); TRACE_CACHE(cache, "delete pages %p (%ld)", pages, id); @@ -305,33 +310,7 @@ } -static status_t -early_allocate_pages(object_cache *cache, void **pages, uint32 flags) -{ - TRACE_CACHE(cache, "early allocate pages (%lu, 0x0%lx)", cache->slab_size, - flags); - - addr_t base = vm_allocate_early(sKernelArgs, cache->slab_size, - cache->slab_size, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); - - *pages = (void *)base; - - cache->usage += cache->slab_size; - - TRACE_CACHE(cache, " ... = { %p }", *pages); - - return B_OK; -} - - static void -early_free_pages(object_cache *cache, void *pages) -{ - panic("memory pressure on bootup?"); -} - - -static void object_cache_low_memory(void *_self, int32 level) { if (level == B_NO_LOW_MEMORY) @@ -442,16 +421,9 @@ cache->destructor = destructor; cache->reclaimer = reclaimer; - if (cache->flags & CACHE_DURING_BOOT) { - cache->allocate_pages = early_allocate_pages; - cache->free_pages = early_free_pages; - } else { - cache->allocate_pages = area_allocate_pages; - cache->free_pages = area_free_pages; - } + if (!sDuringBoot) + register_low_memory_handler(object_cache_low_memory, cache, 5); - register_low_memory_handler(object_cache_low_memory, cache, 5); - BenaphoreLocker _(sObjectCacheListLock); sObjectCaches.Add(cache); @@ -478,7 +450,7 @@ { void *pages = (void *)ROUNDOWN((addr_t)slab->pages, B_PAGE_SIZE); if (create_area(cache->name, &pages, B_EXACT_ADDRESS, cache->slab_size, - B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA) < B_OK) + B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA) < B_OK) panic("failed to create_area()"); } @@ -497,9 +469,6 @@ it = cache->empty.GetIterator(); while (it.HasNext()) object_cache_commit_slab(cache, it.Next()); - - cache->allocate_pages = area_allocate_pages; - cache->free_pages = area_free_pages; } @@ -512,7 +481,7 @@ static SmallObjectCache * -create_small_object_cache(const char *name, size_t object_size, +create_small_object_cache(const char *name, size_t objectSize, size_t alignment, size_t maximum, uint32 flags, void *cookie, object_cache_constructor constructor, object_cache_destructor destructor, object_cache_reclaimer reclaimer) @@ -523,7 +492,7 @@ SmallObjectCache *cache = new (buffer) SmallObjectCache(); - if (object_cache_init(cache, name, object_size, alignment, maximum, flags, + if (object_cache_init(cache, name, objectSize, alignment, maximum, flags, cookie, constructor, destructor, reclaimer) < B_OK) { delete_cache(cache); return NULL; @@ -536,7 +505,7 @@ static HashedObjectCache * -create_hashed_object_cache(const char *name, size_t object_size, +create_hashed_object_cache(const char *name, size_t objectSize, size_t alignment, size_t maximum, uint32 flags, void *cookie, object_cache_constructor constructor, object_cache_destructor destructor, object_cache_reclaimer reclaimer) @@ -547,13 +516,13 @@ HashedObjectCache *cache = new (buffer) HashedObjectCache(); - if (object_cache_init(cache, name, object_size, alignment, maximum, flags, + if (object_cache_init(cache, name, objectSize, alignment, maximum, flags, cookie, constructor, destructor, reclaimer) < B_OK) { delete_cache(cache); return NULL; } - cache->slab_size = max_c(16 * B_PAGE_SIZE, 8 * object_size); + cache->slab_size = max_c(16 * B_PAGE_SIZE, 8 * objectSize); cache->lower_boundary = __fls0(cache->object_size); return cache; @@ -578,9 +547,11 @@ { if (object_size == 0) return NULL; - else if (object_size <= 256) + + if (object_size <= 256) { return create_small_object_cache(name, object_size, alignment, maximum, flags, cookie, constructor, destructor, reclaimer); + } return create_hashed_object_cache(name, object_size, alignment, maximum, flags, cookie, constructor, destructor, reclaimer); @@ -707,11 +678,12 @@ static status_t -object_cache_reserve_internal(object_cache *cache, size_t object_count, +object_cache_reserve_internal(object_cache *cache, size_t objectCount, uint32 flags) { - size_t numBytes = object_count * cache->object_size; + size_t numBytes = objectCount * cache->object_size; size_t slabCount = ((numBytes - 1) / cache->slab_size) + 1; +dprintf("RESERVE INTERNAL %lu\n", slabCount); while (slabCount > 0) { slab *newSlab = cache->CreateSlab(flags); @@ -728,13 +700,13 @@ status_t -object_cache_reserve(object_cache *cache, size_t object_count, uint32 flags) +object_cache_reserve(object_cache *cache, size_t objectCount, uint32 flags) { - if (object_count == 0) + if (objectCount == 0) return B_OK; BenaphoreLocker _(cache->lock); - return object_cache_reserve_internal(cache, object_count, flags); + return object_cache_reserve_internal(cache, objectCount, flags); } @@ -813,9 +785,9 @@ static inline slab * -slab_in_pages(const void *pages, size_t slab_size) +slab_in_pages(const void *pages, size_t slabSize) { - return (slab *)(((uint8 *)pages) + slab_size - sizeof(slab)); + return (slab *)(((uint8 *)pages) + slabSize - sizeof(slab)); } @@ -844,7 +816,6 @@ return NULL; void *pages; - if (allocate_pages(this, &pages, flags) < B_OK) return NULL; @@ -1281,12 +1252,13 @@ sInitialBegin = (uint8 *)initialBase; sInitialLimit = sInitialBegin + initialSize; sInitialPointer = sInitialBegin; + sDuringBoot = true; sKernelArgs = args; new (&sObjectCaches) ObjectCacheList(); - block_allocator_init_boot(); + block_allocator_init(); add_debugger_command("slabs", dump_slabs, "list all object caches"); add_debugger_command("cache_info", dump_cache_info, @@ -1307,10 +1279,12 @@ object_cache *cache = it.Next(); if (object_cache_init_locks(cache) < B_OK) panic("slab_init: failed to create sems"); - if (cache->allocate_pages == early_allocate_pages) - object_cache_commit_pre_pages(cache); + + register_low_memory_handler(object_cache_low_memory, cache, 5); + object_cache_commit_pre_pages(cache); } - block_allocator_init_rest(); + sDuringBoot = false; + block_allocator_init_post_sem(); } Modified: haiku/branches/developer/axeld/slab_heap/src_system_kernel/slab/allocator.cpp =================================================================== --- haiku/branches/developer/axeld/slab_heap/src_system_kernel/slab/allocator.cpp 2008-01-04 17:18:34 UTC (rev 23245) +++ haiku/branches/developer/axeld/slab_heap/src_system_kernel/slab/allocator.cpp 2008-01-04 17:22:51 UTC (rev 23246) @@ -1,18 +1,21 @@ /* - * Copyright 2007, Hugo Santos. All Rights Reserved. + * Copyright 2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2007, Hugo Santos, hugosantos at gmail.com. All Rights Reserved. + * * Distributed under the terms of the MIT License. - * - * Authors: - * Hugo Santos, hugosantos at gmail.com */ + #include #include "slab_private.h" -#include // for ROUNDUP +#include +#include +#include #include +#include #include #define DEBUG_ALLOCATOR @@ -41,6 +44,7 @@ struct area_boundary_tag { area_id area; + size_t area_size; boundary_tag tag; }; @@ -72,33 +76,157 @@ } -void * -block_alloc(size_t size) +static void +block_create_cache(size_t index, bool boot) { + char name[32]; + snprintf(name, sizeof(name), "block cache: %lu", kBlockSizes[index]); + + sBlockCaches[index] = create_object_cache_etc(name, kBlockSizes[index], + 0, 0, 0, NULL, NULL, NULL, NULL); + if (sBlockCaches[index] == NULL) + panic("allocator: failed to init block cache"); + + sBlockCacheWaste[index] = 0; +} + + +static int +show_waste(int argc, char *argv[]) +{ + size_t total = 0; + + for (size_t index = 0; index < kNumBlockSizes; index++) { + if (sBlockCacheWaste[index] > 0) { + kprintf("%lu: %lu\n", kBlockSizes[index], sBlockCacheWaste[index]); + total += sBlockCacheWaste[index]; + } + } + + kprintf("total waste: %lu\n", total); + + return 0; +} + + +void +block_allocator_init() +{ + for (int index = 0; kBlockSizes[index] != 0; index++) { + block_create_cache(index, true); + } +dprintf("HELLO\n"); + object_cache_reserve(sBlockCaches[1], 50, 0); + object_cache_reserve(sBlockCaches[2], 50, 0); + object_cache_reserve(sBlockCaches[13], 50, 0); +dprintf("HELLO usta\n"); + + add_debugger_command("show_waste", show_waste, + "show cache allocator's memory waste"); +} + + +void +block_allocator_init_post_sem() +{ +#ifdef TEST_ALL_CACHES_DURING_BOOT + for (int index = 0; kBlockSizes[index] != 0; index++) { + block_free(block_alloc(kBlockSizes[index] - sizeof(boundary_tag))); + } +#endif +} + + +// #pragma mark - + + +extern "C" void * +malloc_early(struct kernel_args *args, size_t size, size_t *_areaSize) +{ + size_t areaSize = ROUNDUP(size + sizeof(area_boundary_tag), B_PAGE_SIZE); + + addr_t address = vm_allocate_early(args, areaSize, areaSize, + B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); + if (address == NULL) + return NULL; + + area_boundary_tag *areaTag = (area_boundary_tag *)address; + areaTag->area = -1; +dprintf("area tag %p\n", areaTag); + areaTag->area_size = areaSize; + areaTag->tag.size = size; + *_areaSize = areaSize; + +#ifdef DEBUG_ALLOCATOR + areaTag->tag.magic = kBoundaryMagic; +#endif + + return areaTag + 1; +} + + +extern "C" void +malloc_early_create_area(void *address, const char *name) +{ + area_boundary_tag *areaTag = (area_boundary_tag *)((uint8 *)address + - sizeof(area_boundary_tag)); +dprintf("2. area tag %p\n", areaTag); + + address = (void *)areaTag; + areaTag->area = create_area("page cache table", &address, B_EXACT_ADDRESS, + areaTag->area_size, B_ALREADY_WIRED, + B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); +dprintf("************************ ASDFSF ***********************\n"); +} + + +extern "C" void * +memalign(size_t alignment, size_t size) +{ +dprintf("memalign(alignment %lu, size %lu)\n", alignment, size); + if (!kernel_startup && !are_interrupts_enabled()) + panic("realloc(): called with interrupts disabled\n"); + + // ToDo: that code "aligns" the buffer because the bins are always + // aligned on their bin size +// if (size < alignment) +// size = alignment; + if (alignment != 0) + panic("alignment not yet supported!"); + int index = size_to_index(size + sizeof(boundary_tag)); - - void *block; +dprintf("index: %d, size %lu\n", index, size); + void *address; boundary_tag *tag; if (index < 0) { void *pages; - area_id area = create_area("alloc'ed block", &pages, + area_id area = create_area("heap block", &pages, B_ANY_KERNEL_ADDRESS, ROUNDUP(size + sizeof(area_boundary_tag), - B_PAGE_SIZE), B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); + B_PAGE_SIZE), B_FULL_LOCK, + B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); +dprintf("new area %ld, pages %p\n", area, pages); if (area < B_OK) return NULL; area_boundary_tag *areaTag = (area_boundary_tag *)pages; areaTag->area = area; + areaTag->area_size = ROUNDUP(size + sizeof(area_boundary_tag), + B_PAGE_SIZE); tag = &areaTag->tag; - block = areaTag + 1; + address = areaTag + 1; } else { + if (sBlockCaches[index] == NULL) { + panic("HERE"); +dprintf("no init!\n"); + return NULL; + } tag = (boundary_tag *)object_cache_alloc(sBlockCaches[index], 0); if (tag == NULL) return NULL; atomic_add(&sBlockCacheWaste[index], kBlockSizes[index] - size - sizeof(boundary_tag)); - block = tag + 1; + address = tag + 1; } tag->size = size; @@ -107,14 +235,21 @@ tag->magic = kBoundaryMagic; #endif - return block; + return address; } -void -block_free(void *block) +extern "C" void * +malloc(size_t size) { - boundary_tag *tag = (boundary_tag *)(((uint8 *)block) + return memalign(0, size); +} + + +extern "C" void +free(void *address) +{ + boundary_tag *tag = (boundary_tag *)(((uint8 *)address) - sizeof(boundary_tag)); #ifdef DEBUG_ALLOCATOR @@ -125,7 +260,7 @@ int index = size_to_index(tag->size + sizeof(boundary_tag)); if (index < 0) { - area_boundary_tag *areaTag = (area_boundary_tag *)(((uint8 *)block) + area_boundary_tag *areaTag = (area_boundary_tag *)((uint8 *)address - sizeof(area_boundary_tag)); delete_area(areaTag->area); } else { @@ -136,57 +271,67 @@ } -static void -block_create_cache(size_t index, bool boot) +extern "C" void * +realloc(void *address, size_t newSize) { - char name[32]; - snprintf(name, sizeof(name), "block cache: %lu", kBlockSizes[index]); + void *newAddress = NULL; + size_t oldSize = 0; - sBlockCaches[index] = create_object_cache_etc(name, kBlockSizes[index], - 0, 0, boot ? CACHE_DURING_BOOT : 0, NULL, NULL, NULL, NULL); - if (sBlockCaches[index] == NULL) - panic("allocator: failed to init block cache"); + if (!kernel_startup && !are_interrupts_enabled()) + panic("realloc(): called with interrupts disabled\n"); - sBlockCacheWaste[index] = 0; -} + if (newSize == 0) { + free(address); + return NULL; + } + // find out the size of the old allocation first -static int -show_waste(int argc, char *argv[]) -{ - size_t total = 0; + if (address != NULL) { + boundary_tag *tag = (boundary_tag *)((uint8 *)address + - sizeof(boundary_tag)); + int index = size_to_index(tag->size + sizeof(boundary_tag)); - for (size_t index = 0; index < kNumBlockSizes; index++) { - if (sBlockCacheWaste[index] > 0) { - kprintf("%lu: %lu\n", kBlockSizes[index], sBlockCacheWaste[index]); - total += sBlockCacheWaste[index]; - } + if (index < 0) { + // it was an allocated area + area_boundary_tag *areaTag = (area_boundary_tag *)((uint8 *)address + - sizeof(area_boundary_tag)); + if (areaTag->area_size - sizeof(area_boundary_tag) > newSize) { + tag->size = newSize; + return address; + } else + oldSize = tag->size; + } else if (kBlockSizes[index] >= newSize) { + tag->size = newSize; + return address; + } else + oldSize = tag->size; } - kprintf("total waste: %lu\n", total); + // we need to allocate new space - return 0; -} + newAddress = malloc(newSize); + if (newAddress == NULL) + return NULL; + // copy the old data and free the old allocation + if (address != NULL) { + // we do have the maxSize of the bin at this point + memcpy(newAddress, address, min_c(oldSize, newSize)); + free(address); + } -void -block_allocator_init_boot() -{ - for (int index = 0; kBlockSizes[index] != 0; index++) - block_create_cache(index, true); - - add_debugger_command("show_waste", show_waste, - "show cache allocator's memory waste"); + return newAddress; } -void -block_allocator_init_rest() +extern "C" void * +calloc(size_t numElements, size_t size) { -#ifdef TEST_ALL_CACHES_DURING_BOOT - for (int index = 0; kBlockSizes[index] != 0; index++) { - block_free(block_alloc(kBlockSizes[index] - sizeof(boundary_tag))); - } -#endif + void *address = malloc(numElements * size); + if (address != NULL) + memset(address, 0, numElements * size); + + return address; } Modified: haiku/branches/developer/axeld/slab_heap/src_system_kernel/slab/slab_private.h =================================================================== --- haiku/branches/developer/axeld/slab_heap/src_system_kernel/slab/slab_private.h 2008-01-04 17:18:34 UTC (rev 23245) +++ haiku/branches/developer/axeld/slab_heap/src_system_kernel/slab/slab_private.h 2008-01-04 17:22:51 UTC (rev 23246) @@ -1,19 +1,15 @@ /* * Copyright 2007, Hugo Santos. All Rights Reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Hugo Santos, hugosantos at gmail.com */ #ifndef _SLAB_PRIVATE_H_ #define _SLAB_PRIVATE_H_ + #include -void *block_alloc(size_t size); -void block_free(void *block); -void block_allocator_init_boot(); -void block_allocator_init_rest(); -#endif +void block_allocator_init(); +void block_allocator_init_post_sem(); +#endif /* _SLAB_PRIVATE_H_ */ Modified: haiku/branches/developer/axeld/slab_heap/src_system_kernel/util/khash.c =================================================================== --- haiku/branches/developer/axeld/slab_heap/src_system_kernel/util/khash.c 2008-01-04 17:18:34 UTC (rev 23245) +++ haiku/branches/developer/axeld/slab_heap/src_system_kernel/util/khash.c 2008-01-04 17:22:51 UTC (rev 23246) @@ -51,7 +51,15 @@ }; -static uint32 +static inline void * +next_element(hash_table *table, void *element) +{ + // ToDo: should we use this instead of the NEXT() macro? + return (void *)(*(unsigned long *)NEXT_ADDR(table, element)); +} + + +uint32 get_prime_table_size(uint32 size) { int i; @@ -64,26 +72,16 @@ } -static inline void * -next_element(hash_table *table, void *element) -{ - // ToDo: should we use this instead of the NEXT() macro? - return (void *)(*(unsigned long *)NEXT_ADDR(table, element)); -} - - struct hash_table * -hash_init(uint32 table_size, int next_ptr_offset, - int compare_func(void *e, const void *key), - uint32 hash_func(void *e, const void *key, uint32 range)) +hash_init_etc(void *table, uint32 tableSize, uint32 nextOffset, + int compareFunc(void *e, const void *key), + uint32 hashFunc(void *e, const void *key, uint32 range)) { struct hash_table *t; unsigned int i; - table_size = get_prime_table_size(table_size); - - if (compare_func == NULL || hash_func == NULL) { - dprintf("hash_init() called with NULL function pointer\n"); + if (compareFunc == NULL || hashFunc == NULL || table == NULL) { + dprintf("hash_init_etc() called with NULL pointer\n"); return NULL; } @@ -91,38 +89,54 @@ if (t == NULL) return NULL; - t->table = (struct hash_element **)malloc(sizeof(void *) * table_size); - if (t->table == NULL) { - free(t); - return NULL; - } - - for (i = 0; i < table_size; i++) - t->table[i] = NULL; - - t->table_size = table_size; - t->next_ptr_offset = next_ptr_offset; + t->table = table; + t->table_size = tableSize; + t->next_ptr_offset = nextOffset; t->flags = 0; t->num_elements = 0; - t->compare_func = compare_func; - t->hash_func = hash_func; + t->compare_func = compareFunc; + t->hash_func = hashFunc; - TRACE(("hash_init: created table %p, next_ptr_offset %d, compare_func %p, hash_func %p\n", - t, next_ptr_offset, compare_func, hash_func)); + TRACE(("hash_init_etc: created table %p, next_ptr_offset %d, compare_func " + "%p, hash_func %p\n", t, nextOffset, compareFunc, hashFunc)); return t; } -int +struct hash_table * +hash_init(uint32 tableSize, uint32 nextOffset, + int compareFunc(void *e, const void *key), + uint32 hashFunc(void *e, const void *key, uint32 range)) +{ + struct hash_table *hashTable; + void *table; + + tableSize = get_prime_table_size(tableSize); + + table = (struct hash_element **)malloc(sizeof(void *) * tableSize); + if (table == NULL) + return NULL; + + hashTable = hash_init_etc(table, tableSize, nextOffset, compareFunc, + hashFunc); + if (hashTable == NULL) { + free(table); + return NULL; + } + + memset(table, 0, sizeof(void *) * tableSize); + return hashTable; +} + + +void hash_uninit(struct hash_table *table) { ASSERT(table->num_elements == 0); free(table->table); free(table); [... truncated: 200 lines follow ...] From korli at users.berlios.de Fri Jan 4 20:55:32 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Fri, 4 Jan 2008 20:55:32 +0100 Subject: [Haiku-commits] r23242 - haiku/trunk/src/apps/expander In-Reply-To: <200801041712.m04HCBcC013950@sheep.berlios.de> References: <200801041712.m04HCBcC013950@sheep.berlios.de> Message-ID: 2008/1/4, axeld at BerliOS : > Author: axeld > Date: 2008-01-04 18:12:11 +0100 (Fri, 04 Jan 2008) > New Revision: 23242 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23242&view=rev > > Modified: > haiku/trunk/src/apps/expander/ExpanderRules.cpp > Log: > Applied patch by Fredrik Ekdahl, this fixes bug #1695. > It should have worked before. This hides another problem. Bye, J?r?me From marcusoverhagen at mail.berlios.de Fri Jan 4 22:24:52 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Fri, 4 Jan 2008 22:24:52 +0100 Subject: [Haiku-commits] r23247 - haiku/trunk/src/add-ons/kernel/busses/scsi/ahci Message-ID: <200801042124.m04LOq4g021781@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-04 22:24:51 +0100 (Fri, 04 Jan 2008) New Revision: 23247 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23247&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h Log: Added a comment describing the command FIS layout, because AHCI, SATA and ATA/ATAPI standards use inconsitent terminology. Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h 2008-01-04 17:22:51 UTC (rev 23246) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h 2008-01-04 21:24:51 UTC (rev 23247) @@ -196,6 +196,27 @@ #define COMMAND_LIST_ENTRY_COUNT 32 +// Command FIS layout - Host to Device (H2D) +// 0 - FIS Type (0x27) +// 1 - C bit (0x80) +// 2 - Command +// 3 - Features +// 4 - Sector Number (LBA Low, bits 0-7) +// 5 - Cylinder Low (LBA Mid, bits 8-15) +// 6 - Cylinder High (LBA High, bits 16-23) +// 7 - Device / Head (for 28-bit LBA commands, bits 24-27) +// 8 - Sector Number expanded (LBA Low-previous, bits 24-31) +// 9 - Cylinder Low expanded (LBA Mid-previous, bits 32-39) +// 10 - Cylinder High expanded (LBA High-previous, bits 40-47) +// 11 - Features expanded +// 12 - Sector Count (Sector count, bits 0-7) +// 13 - Sector Count expanded (Sector count, bits 8-15) +// 14 - Reserved (0) +// 15 - Control +// 16 - Reserved (0) +// 17 - Reserved (0) +// 18 - Reserved (0) +// 19 - Reserved (0) typedef struct { uint8 cfis[0x40]; // command FIS uint8 acmd[0x20]; // ATAPI command From axeld at pinc-software.de Fri Jan 4 23:55:31 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 04 Jan 2008 23:55:31 +0100 CET Subject: [Haiku-commits] r23242 - haiku/trunk/src/apps/expander In-Reply-To: Message-ID: <42587932721-BeMail@zon> "J?r?me Duval" wrote: > > Log: > > Applied patch by Fredrik Ekdahl, this fixes bug #1695. > It should have worked before. This hides another problem. Do we have another test case to open a bug for this? :-) Bye, Axel. From marcusoverhagen at mail.berlios.de Sat Jan 5 03:19:59 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 5 Jan 2008 03:19:59 +0100 Subject: [Haiku-commits] r23248 - haiku/trunk/src/add-ons/kernel/busses/scsi/ahci Message-ID: <200801050219.m052JxjV030848@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-05 03:19:58 +0100 (Sat, 05 Jan 2008) New Revision: 23248 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23248&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h Log: added defines for LBA limitations Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h 2008-01-04 21:24:51 UTC (rev 23247) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h 2008-01-05 02:19:58 UTC (rev 23248) @@ -251,6 +251,11 @@ extern pci_device_module_info *gPCI; extern scsi_for_sim_interface *gSCSI; + +#define MAX_SECTOR_LBA_28 ((1ull << 28) - 1) +#define MAX_SECTOR_LBA_48 ((1ull << 48) - 1) + + #define LO32(val) ((uint32)(val)) #define HI32(val) (((uint64)(val)) >> 32) #define ASSERT(expr) if (expr) {} else panic(#expr) From marcusoverhagen at mail.berlios.de Sat Jan 5 03:23:41 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 5 Jan 2008 03:23:41 +0100 Subject: [Haiku-commits] r23249 - haiku/trunk/src/add-ons/kernel/busses/scsi/ahci Message-ID: <200801050223.m052Nf6O031081@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-05 03:23:39 +0100 (Sat, 05 Jan 2008) New Revision: 23249 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23249&view=rev Added: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/sata_request.cpp haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/sata_request.h Log: A helper class to easier support Native Command Qeueuing and ATAPI support. This class either encapsulates scsi_ccb or can be used stand alone. Added: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/sata_request.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/sata_request.cpp 2008-01-05 02:19:58 UTC (rev 23248) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/sata_request.cpp 2008-01-05 02:23:39 UTC (rev 23249) @@ -0,0 +1,134 @@ +/* + * Copyright 2008, Marcus Overhagen. All rights reserved. + * Distributed under the terms of the MIT License. + */ + +#include "sata_request.h" +#include + +sata_request::sata_request() + : fCcb(NULL) + , fCompletionSem(create_sem(0, "sata completion")) + , fCompletionStatus(0) + , fData(NULL) + , fDataSize(0) +{ +} + + +sata_request::sata_request(scsi_ccb *ccb) + : fCcb(ccb) + , fCompletionSem(-1) + , fCompletionStatus(0) + , fData(NULL) + , fDataSize(0) +{ +} + + +sata_request::~sata_request() +{ + if (fCompletionSem >= 0) + delete_sem(fCompletionSem); +} + + +void +sata_request::set_data(void *data, size_t dataSize) +{ + if (fCcb) panic("wrong usage"); + fData = data; + fDataSize = dataSize; +} + + +void +sata_request::set_ata_cmd(uint8 command) +{ + memset(fFis, 0, sizeof(fFis)); + fFis[0] = 0x27; + fFis[1] = 0x80; + fFis[2] = command; +} + + +void +sata_request::set_ata28_cmd(uint8 command, uint32 lba, uint8 sectorCount) +{ + set_ata_cmd(command); + fFis[4] = lba & 0xff; + fFis[5] = (lba >> 8) & 0xff; + fFis[6] = (lba >> 16) & 0xff; + fFis[7] = 0x40 | ((lba >> 24) & 0x0f); + fFis[12] = sectorCount & 0xff; +} + + +void +sata_request::set_ata48_cmd(uint8 command, uint64 lba, uint16 sectorCount) +{ + set_ata_cmd(command); + fFis[4] = lba & 0xff; + fFis[5] = (lba >> 8) & 0xff; + fFis[6] = (lba >> 16) & 0xff; + fFis[7] = 0x40; + fFis[8] = (lba >> 24) & 0xff; + fFis[9] = (lba >> 32) & 0xff; + fFis[10] = (lba >> 40) & 0xff; + fFis[12] = sectorCount & 0xff; + fFis[13] = (sectorCount >> 8) & 0xff; +} + + +void +sata_request::finish(int tfd, size_t bytesTransfered) +{ + if (tfd & ATA_ERR) + dprintf("ahci: sata_request::finish ATA_ERR set for command 0x%02x\n", fFis[2]); + if (fCcb) { + fCcb->data_resid = fCcb->data_length - bytesTransfered; + fCcb->subsys_status = (tfd & ATA_ERR) ? SCSI_REQ_CMP_ERR : SCSI_REQ_CMP; + gSCSI->finished(fCcb, 1); + delete this; + } else { + fCompletionStatus = tfd; + release_sem(fCompletionSem); + } +} + + +void +sata_request::abort() +{ + dprintf("ahci: sata_request::abort called for command 0x%02x\n", fFis[2]); + if (fCcb) { + fCcb->subsys_status = SCSI_REQ_ABORTED; + gSCSI->finished(fCcb, 1); + delete this; + } else { + fCompletionStatus = -1; + release_sem(fCompletionSem); + } +} + + +void +sata_request::wait_for_completition() +{ + if (fCcb) panic("wrong usage"); + acquire_sem(fCompletionSem); +} + + +int +sata_request::completition_status() +{ + if (fCcb) panic("wrong usage"); + return fCompletionStatus; +} + + + + + + Added: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/sata_request.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/sata_request.h 2008-01-05 02:19:58 UTC (rev 23248) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/sata_request.h 2008-01-05 02:23:39 UTC (rev 23249) @@ -0,0 +1,71 @@ +/* + * Copyright 2008, Marcus Overhagen. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _SATA_REQUEST_H +#define _SATA_REQUEST_H + +#include "ahci_defs.h" + +class sata_request +{ +public: + sata_request(); + sata_request(scsi_ccb *ccb); + ~sata_request(); + + void set_data(void *data, size_t dataSize); + + void set_ata_cmd(uint8 command); + void set_ata28_cmd(uint8 command, uint32 lba, uint8 sectorCount); + void set_ata48_cmd(uint8 command, uint64 lba, uint16 sectorCount); + + scsi_ccb * ccb(); + const void * fis(); + void * data(); + int size(); + void finish(int tfd, size_t bytesTransfered); + void abort(); + + void wait_for_completition(); + int completition_status(); + +private: + scsi_ccb * fCcb; + uint8 fFis[20]; + sem_id fCompletionSem; + int fCompletionStatus; + void * fData; + size_t fDataSize; +}; + + +inline scsi_ccb * +sata_request::ccb() +{ + return fCcb; +} + + +inline const void * +sata_request::fis() +{ + return fFis; +} + + +inline void * +sata_request::data() +{ + return fData; +} + + +inline int +sata_request::size() +{ + return fDataSize; +} + + +#endif From marcusoverhagen at mail.berlios.de Sat Jan 5 03:27:08 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 5 Jan 2008 03:27:08 +0100 Subject: [Haiku-commits] r23250 - haiku/trunk/src/add-ons/kernel/busses/scsi/ahci Message-ID: <200801050227.m052R8VG031368@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-05 03:27:05 +0100 (Sat, 05 Jan 2008) New Revision: 23250 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23250&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/Jamfile haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci.c haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.h haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_sim.cpp Log: Implemented ExecuteSataRequest() to execute all ATA and (later) ATAPI commands. Converted Identify Device and Read / Write commands, they now create a sata_request and pass it to ExecuteSataRequest. Added support for cache flushing. Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/Jamfile 2008-01-05 02:23:39 UTC (rev 23249) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/Jamfile 2008-01-05 02:27:05 UTC (rev 23250) @@ -8,5 +8,6 @@ ahci_controller.cpp ahci_port.cpp ahci_sim.cpp + sata_request.cpp util.c ; Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci.c 2008-01-05 02:23:39 UTC (rev 23249) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci.c 2008-01-05 02:27:05 UTC (rev 23250) @@ -17,9 +17,7 @@ #define AHCI_ID_GENERATOR "ahci/id" #define AHCI_ID_ITEM "ahci/id" -device_manager_info *gDeviceManager; - const device_info kSupportedDevices[] = { { 0x1002, 0x4380, "ATI SB600" }, { 0x1002, 0x4390, "ATI SB700/800" }, @@ -372,12 +370,15 @@ ahci_get_supported_paths, }; + module_dependency module_dependencies[] = { { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&gDeviceManager }, +// { B_PCI_MODULE_NAME, (module_info **)&gPCI }, { SCSI_FOR_SIM_MODULE_NAME, (module_info **)&gSCSI }, {} }; + module_info *modules[] = { (module_info *)&sAHCIDevice, (module_info *)&gAHCISimInterface, Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 2008-01-05 02:23:39 UTC (rev 23249) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 2008-01-05 02:27:05 UTC (rev 23250) @@ -8,6 +8,7 @@ #include "util.h" #include "ata_cmds.h" #include "scsi_cmds.h" +#include "sata_request.h" #include #include @@ -15,9 +16,9 @@ #include #define TRACE(a...) dprintf("\33[34mahci:\33[0m " a) -// #define FLOW(a...) dprintf("ahci: " a) -#define FLOW(a...) +//#define FLOW(a...) dprintf("ahci: " a) //#define RWTRACE(a...) dprintf("\33[34mahci:\33[0m " a) +#define FLOW(a...) #define RWTRACE(a...) @@ -400,9 +401,10 @@ TRACE("AHCIPort::ScsiInquiry port %d\n", fIndex); scsi_cmd_inquiry *cmd = (scsi_cmd_inquiry *)request->cdb; - scsi_res_inquiry scsiData; ata_res_identify_device ataData; + ASSERT(sizeof(ataData) == 512); + if (cmd->evpd || cmd->page_code) { TRACE("invalid request\n"); request->subsys_status = SCSI_REQ_ABORTED; @@ -410,67 +412,27 @@ return; } - memset(&ataData, 0, sizeof(ataData)); + sata_request sreq; + sreq.set_data(&ataData, sizeof(ataData)); + sreq.set_ata_cmd(0xec); // Identify Device + ExecuteSataRequest(&sreq); + sreq.wait_for_completition(); - StartTransfer(); - - int prdEntrys; - FillPrdTable(fPRDTable, &prdEntrys, PRD_TABLE_ENTRY_COUNT, &ataData, sizeof(ataData)); - - - FLOW("prdEntrys %d\n", prdEntrys); - - memset((void *)fCommandTable->cfis, 0, 5 * 4); - fCommandTable->cfis[0] = 0x27; - fCommandTable->cfis[1] = 0x80; - fCommandTable->cfis[2] = 0xec; - - - fCommandList->prdtl_flags_cfl = 0; - fCommandList->prdtl = prdEntrys; - fCommandList->cfl = 5; - fCommandList->prdbc = 0; - - if (wait_until_clear(&fRegs->tfd, ATA_BSY | ATA_DRQ, 4000000) < B_OK) { - TRACE("device is busy\n"); - FinishTransfer(); - request->subsys_status = SCSI_REQ_ABORTED; + if (sreq.completition_status() & ATA_ERR) { + TRACE("identify device failed\n"); + request->subsys_status = SCSI_REQ_CMP_ERR; gSCSI->finished(request, 1); return; } - cpu_status cpu = disable_interrupts(); - acquire_spinlock(&fSpinlock); - fRegs->ci |= 1; - FlushPostedWrites(); - fCommandsActive |= 1; - release_spinlock(&fSpinlock); - restore_interrupts(cpu); - - int status; - WaitForTransfer(&status, 100000); - - FLOW("prdbc %ld\n", fCommandList->prdbc); - FLOW("ci 0x%08lx\n", fRegs->ci); - FLOW("is 0x%08lx\n", fRegs->is); - FLOW("serr 0x%08lx\n", fRegs->serr); - /* - TRACE("ci 0x%08lx\n", fRegs->ci); - TRACE("ie 0x%08lx\n", fRegs->ie); - TRACE("is 0x%08lx\n", fRegs->is); - TRACE("cmd 0x%08lx\n", fRegs->cmd); - TRACE("ssts 0x%08lx\n", fRegs->ssts); - TRACE("sctl 0x%08lx\n", fRegs->sctl); - TRACE("serr 0x%08lx\n", fRegs->serr); - TRACE("sact 0x%08lx\n", fRegs->sact); - TRACE("tfd 0x%08lx\n", fRegs->tfd); - uint8 *data = (uint8*) &ataData; for (int i = 0; i < 512; i += 8) { TRACE(" %02x %02x %02x %02x %02x %02x %02x %02x\n", data[i], data[i+1], data[i+2], data[i+3], data[i+4], data[i+5], data[i+6], data[i+7]); } */ + + scsi_res_inquiry scsiData; scsiData.device_type = scsi_dev_direct_access; scsiData.device_qualifier = scsi_periph_qual_connected; scsiData.device_type_modifier = 0; @@ -532,10 +494,18 @@ request->data_resid = request->data_length - sizeof(scsiData);// ??? request->data_length = sizeof(scsiData); // ??? } + gSCSI->finished(request, 1); +} - FinishTransfer(); - gSCSI->finished(request, 1); +void +AHCIPort::ScsiSynchronizeCache(scsi_ccb *request) +{ + TRACE("AHCIPort::ScsiSynchronizeCache port %d\n", fIndex); + + sata_request *sreq = new sata_request(request); + sreq->set_ata_cmd(fUse48BitCommands ? 0xea : 0xe7); // Flush Cache + ExecuteSataRequest(sreq); } @@ -575,7 +545,6 @@ AHCIPort::ScsiReadWrite(scsi_ccb *request, uint64 position, size_t length, bool isWrite) { uint32 bytecount = length * 512; - RWTRACE("ScsiReadWrite: position %llu, size %lu, isWrite %d\n", position * 512, bytecount, isWrite); #if 0 @@ -587,60 +556,61 @@ return; } #endif - - StartTransfer(); - - int prdEntrys; - FillPrdTable(fPRDTable, &prdEntrys, PRD_TABLE_ENTRY_COUNT, request->sg_list, request->sg_count, bytecount); - - FLOW("prdEntrys %d\n", prdEntrys); - memset((void *)fCommandTable->cfis, 0, 5 * 4); + request->data_length = bytecount; // XXX really? + sata_request *sreq = new sata_request(request); if (fUse48BitCommands) { if (length > 65536) panic("ahci: ScsiReadWrite length too large, %lu sectors", length); - fCommandTable->cfis[0] = 0x27; - fCommandTable->cfis[1] = 0x80; - fCommandTable->cfis[2] = isWrite ? 0x35 : 0x25; - fCommandTable->cfis[4] = position & 0xff; - fCommandTable->cfis[5] = (position >> 8) & 0xff; - fCommandTable->cfis[6] = (position >> 16) & 0xff; - fCommandTable->cfis[7] = 0x40; - fCommandTable->cfis[8] = (position >> 24) & 0xff; - fCommandTable->cfis[9] = (position >> 32) & 0xff; - fCommandTable->cfis[10] = (position >> 40) & 0xff; - fCommandTable->cfis[12] = length & 0xff; - fCommandTable->cfis[13] = (length >> 8) & 0xff; + if (position > MAX_SECTOR_LBA_48) + panic("achi: ScsiReadWrite position too large for 48-bit LBA\n"); + sreq->set_ata48_cmd(isWrite ? 0x35 : 0x25, position, length); } else { if (length > 256) panic("ahci: ScsiReadWrite length too large, %lu sectors", length); - if (position > 0x0fffffff) - panic("achi: ScsiReadWrite position too large for non-48-bit LBA\n"); - fCommandTable->cfis[0] = 0x27; - fCommandTable->cfis[1] = 0x80; - fCommandTable->cfis[2] = isWrite ? 0xca : 0xc8; - fCommandTable->cfis[4] = position & 0xff; - fCommandTable->cfis[5] = (position >> 8) & 0xff; - fCommandTable->cfis[6] = (position >> 16) & 0xff; - fCommandTable->cfis[7] = 0x40 | ((position >> 24) & 0x0f); - fCommandTable->cfis[12] = length & 0xff; + if (position > MAX_SECTOR_LBA_28) + panic("achi: ScsiReadWrite position too large for normal LBA\n"); + sreq->set_ata28_cmd(isWrite ? 0xca : 0xc8, position, length); } + ExecuteSataRequest(sreq, isWrite); +} + + +void +AHCIPort::ExecuteSataRequest(sata_request *request, bool isWrite) +{ + FLOW("ExecuteAtaRequest port %d\n", fIndex); + + StartTransfer(); + + int prdEntrys; + + if (request->ccb()) + FillPrdTable(fPRDTable, &prdEntrys, PRD_TABLE_ENTRY_COUNT, request->ccb()->sg_list, request->ccb()->sg_count, request->ccb()->data_length); + else if (request->data() && request->size()) + FillPrdTable(fPRDTable, &prdEntrys, PRD_TABLE_ENTRY_COUNT, request->data(), request->size()); + else + prdEntrys = 0; + + FLOW("prdEntrys %d\n", prdEntrys); + + memcpy((char *)fCommandTable->cfis, request->fis(), 20); fCommandList->prdtl_flags_cfl = 0; - fCommandList->prdtl = prdEntrys; - fCommandList->cfl = 5; + fCommandList->cfl = 5; // length is 20 bytes, in DWORDS if (isWrite) fCommandList->w = 1; + fCommandList->prdtl = prdEntrys; fCommandList->prdbc = 0; - if (wait_until_clear(&fRegs->tfd, ATA_BSY | ATA_DRQ, 4000000) < B_OK) { - TRACE("device is busy\n"); + if (wait_until_clear(&fRegs->tfd, ATA_BSY | ATA_DRQ, 1000000) < B_OK) { + TRACE("ExecuteAtaRequest port %d: device is busy\n", fIndex); FinishTransfer(); - request->subsys_status = SCSI_REQ_ABORTED; - gSCSI->finished(request, 1); + request->abort(); return; } + cpu_status cpu = disable_interrupts(); acquire_spinlock(&fSpinlock); fRegs->ci |= 1; @@ -650,28 +620,35 @@ restore_interrupts(cpu); int tfd; - status_t status = WaitForTransfer(&tfd, 4000000); + status_t status = WaitForTransfer(&tfd, 5000000); + FLOW("tfd %#x\n", tfd); FLOW("prdbc %ld\n", fCommandList->prdbc); + FLOW("ci 0x%08lx\n", fRegs->ci); + FLOW("is 0x%08lx\n", fRegs->is); + FLOW("serr 0x%08lx\n", fRegs->serr); - if (status < B_OK) { - TRACE("ScsiReadWrite port %d: device timeout\n", fIndex); - request->subsys_status = SCSI_REQ_ABORTED; - } else if (tfd & ATA_ERR) { - TRACE("ScsiReadWrite port %d: device error\n", fIndex); - request->subsys_status = SCSI_REQ_ABORTED; - } else if (fCommandList->prdbc != bytecount) { - TRACE("ScsiReadWrite port %d: should never happen\n", fIndex); - request->subsys_status = SCSI_REQ_CMP_ERR; - } else { - request->subsys_status = SCSI_REQ_CMP; - } - request->data_resid = request->data_length - fCommandList->prdbc;// ??? - request->data_length = fCommandList->prdbc; // ??? +/* + TRACE("ci 0x%08lx\n", fRegs->ci); + TRACE("ie 0x%08lx\n", fRegs->ie); + TRACE("is 0x%08lx\n", fRegs->is); + TRACE("cmd 0x%08lx\n", fRegs->cmd); + TRACE("ssts 0x%08lx\n", fRegs->ssts); + TRACE("sctl 0x%08lx\n", fRegs->sctl); + TRACE("serr 0x%08lx\n", fRegs->serr); + TRACE("sact 0x%08lx\n", fRegs->sact); + TRACE("tfd 0x%08lx\n", fRegs->tfd); +*/ + size_t bytesTransfered = fCommandList->prdbc; + FinishTransfer(); - gSCSI->finished(request, 1); + if (status < B_OK) { + TRACE("ExecuteAtaRequest port %d: device transfer timeout\n", fIndex); + request->abort(); + } else + request->finish(tfd, bytesTransfered); } @@ -687,7 +664,7 @@ } if (!fDevicePresent) { - TRACE("no such device!\n"); + TRACE("no device present on port %d\n", fIndex); request->subsys_status = SCSI_DEV_NOT_THERE; gSCSI->finished(request, 1); return; @@ -705,6 +682,9 @@ case SCSI_OP_READ_CAPACITY: ScsiReadCapacity(request); break; + case SCSI_OP_SYNCHRONIZE_CACHE: + ScsiSynchronizeCache(request); + break; case SCSI_OP_READ_6: case SCSI_OP_WRITE_6: { Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.h 2008-01-05 02:23:39 UTC (rev 23249) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.h 2008-01-05 02:27:05 UTC (rev 23250) @@ -8,6 +8,7 @@ #include "ahci_defs.h" class AHCIController; +class sata_request; class AHCIPort { public: @@ -32,7 +33,10 @@ void ScsiInquiry(scsi_ccb *request); void ScsiReadCapacity(scsi_ccb *request); void ScsiReadWrite(scsi_ccb *request, uint64 position, size_t length, bool isWrite); + void ScsiSynchronizeCache(scsi_ccb *request); + void ExecuteSataRequest(sata_request *request, bool isWrite = false); + status_t ResetDevice(); status_t PostResetDevice(); void FlushPostedWrites(); Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_sim.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_sim.cpp 2008-01-05 02:23:39 UTC (rev 23249) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_sim.cpp 2008-01-05 02:27:05 UTC (rev 23250) @@ -15,6 +15,7 @@ pci_device_module_info *gPCI; +device_manager_info *gDeviceManager; scsi_for_sim_interface *gSCSI; From axeld at mail.berlios.de Sat Jan 5 14:45:32 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 5 Jan 2008 14:45:32 +0100 Subject: [Haiku-commits] r23251 - haiku/trunk/src/add-ons/kernel/network/protocols/tcp Message-ID: <200801051345.m05DjWVY004203@sheep.berlios.de> Author: axeld Date: 2008-01-05 14:45:31 +0100 (Sat, 05 Jan 2008) New Revision: 23251 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23251&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp Log: * TCP must not lock the endpoint's lock in _TimeWaitTimer() - it will deadlock with its destructor when the socket is deleted. This effectively stopped all network timers from working. This will not only fix bug #1693, but also many other networking problems I've seen so far. * Minor cleanup (mostly line breaks, strange indenting and superfluous parentheses). Modified: haiku/trunk/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp 2008-01-05 02:27:05 UTC (rev 23250) +++ haiku/trunk/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp 2008-01-05 13:45:31 UTC (rev 23251) @@ -459,8 +459,10 @@ locker.Lock(); status = gSocketModule->dequeue_connected(socket, _acceptedSocket); +#ifdef TRACE_TCP if (status == B_OK) TRACE(" Accept() returning %p", (*_acceptedSocket)->first_protocol); +#endif } while (status < B_OK); return status; @@ -551,11 +553,11 @@ if (fState == CLOSED) return ENOTCONN; - else if (fState == LISTEN) { + if (fState == LISTEN) return EDESTADDRREQ; - } else if (fState == FINISH_SENT || fState == FINISH_ACKNOWLEDGED - || fState == CLOSING || fState == WAIT_FOR_FINISH_ACKNOWLEDGE - || fState == TIME_WAIT) { + if (fState == FINISH_SENT || fState == FINISH_ACKNOWLEDGED + || fState == CLOSING || fState == WAIT_FOR_FINISH_ACKNOWLEDGE + || fState == TIME_WAIT) { // TODO: send SIGPIPE signal to app? return EPIPE; } @@ -651,15 +653,15 @@ while (true) { if (fState == CLOSING || fState == WAIT_FOR_FINISH_ACKNOWLEDGE - || fState == TIME_WAIT) { + || fState == TIME_WAIT) { // ``Connection closing''. return B_OK; } if (fReceiveQueue.Available() > 0) { - if (fReceiveQueue.Available() >= dataNeeded || - ((fReceiveQueue.PushedData() > 0) - && (fReceiveQueue.PushedData() >= fReceiveQueue.Available()))) + if (fReceiveQueue.Available() >= dataNeeded + || (fReceiveQueue.PushedData() > 0 + && fReceiveQueue.PushedData() >= fReceiveQueue.Available())) break; } else if (fState == FINISH_RECEIVED) { // ``If no text is awaiting delivery, the RECEIVE will @@ -667,7 +669,7 @@ return B_OK; } - if ((flags & MSG_DONTWAIT) || (socket->receive.timeout == 0)) + if ((flags & MSG_DONTWAIT) != 0 || socket->receive.timeout == 0) return B_WOULD_BLOCK; status_t status = fReceiveList.Wait(locker, timeout, false); @@ -677,7 +679,7 @@ // available. So we actually check if there is data, and if so, // push it to the user. if ((status == B_TIMED_OUT || status == B_INTERRUPTED) - && fReceiveQueue.Available() > 0) + && fReceiveQueue.Available() > 0) break; return posix_error(status); @@ -772,7 +774,8 @@ return SendAcknowledge(true); } - gStackModule->set_timer(&fDelayedAcknowledgeTimer, TCP_DELAYED_ACKNOWLEDGE_TIMEOUT); + gStackModule->set_timer(&fDelayedAcknowledgeTimer, + TCP_DELAYED_ACKNOWLEDGE_TIMEOUT); return B_OK; } @@ -794,6 +797,7 @@ void TCPEndpoint::_EnterTimeWait() { + TRACE("_EnterTimeWait()\n"); gStackModule->set_timer(&fTimeWaitTimer, TCP_MAX_SEGMENT_LIFETIME << 1); } @@ -910,7 +914,8 @@ int32 -TCPEndpoint::_SynchronizeSentReceive(tcp_segment_header &segment, net_buffer *buffer) +TCPEndpoint::_SynchronizeSentReceive(tcp_segment_header &segment, + net_buffer *buffer) { TRACE("SynchronizeSentReceive()"); @@ -993,7 +998,8 @@ int32 TCPEndpoint::_SegmentReceived(tcp_segment_header &segment, net_buffer *buffer) { - uint32 advertisedWindow = (uint32)segment.advertised_window << fSendWindowShift; + uint32 advertisedWindow = (uint32)segment.advertised_window + << fSendWindowShift; // First, handle the most common case for uni-directional data transfer // (known as header prediction - the segment must not change the window, @@ -1004,7 +1010,6 @@ && fReceiveNext == segment.sequence && advertisedWindow > 0 && advertisedWindow == fSendWindow && fSendNext == fSendMax) { - _UpdateTimestamps(segment, buffer->size); if (buffer->size == 0) { @@ -1020,8 +1025,9 @@ && !(fFlags & FLAG_NO_RECEIVE)) { if (_AddData(segment, buffer)) _NotifyReader(); - return KEEP | ((segment.flags & TCP_FLAG_PUSH) ? - IMMEDIATE_ACKNOWLEDGE : ACKNOWLEDGE); + + return KEEP | ((segment.flags & TCP_FLAG_PUSH) != 0 + ? IMMEDIATE_ACKNOWLEDGE : ACKNOWLEDGE); } } @@ -1108,7 +1114,8 @@ return true; } - if ((segment.flags & (TCP_FLAG_SYNCHRONIZE | TCP_FLAG_FINISH | TCP_FLAG_RESET)) != 0) + if ((segment.flags & (TCP_FLAG_SYNCHRONIZE | TCP_FLAG_FINISH + | TCP_FLAG_RESET)) != 0) return true; // there is no reason to send a segment just now @@ -1140,14 +1147,14 @@ tcp_segment_header segment(_CurrentFlags()); if ((fOptions & TCP_NOOPT) == 0) { - if (fFlags & FLAG_OPTION_TIMESTAMP) { + if ((fFlags & FLAG_OPTION_TIMESTAMP) != 0) { segment.options |= TCP_HAS_TIMESTAMPS; segment.timestamp_reply = fReceivedTimestamp; segment.timestamp_value = tcp_now(); } - if ((segment.flags & TCP_FLAG_SYNCHRONIZE) - && (fSendNext == fInitialSendSequence)) { + if ((segment.flags & TCP_FLAG_SYNCHRONIZE) != 0 + && fSendNext == fInitialSendSequence) { // add connection establishment options segment.max_segment_size = fReceiveMaxSegmentSize; if (fFlags & FLAG_OPTION_WINDOW_SCALE) { @@ -1294,7 +1301,8 @@ fLastAcknowledgeSent = segment.acknowledge; length -= segmentLength; - segment.flags &= ~(TCP_FLAG_SYNCHRONIZE | TCP_FLAG_RESET | TCP_FLAG_FINISH); + segment.flags &= ~(TCP_FLAG_SYNCHRONIZE | TCP_FLAG_RESET + | TCP_FLAG_FINISH); } while (length > 0); // if we sent data from the beggining of the send queue, @@ -1348,7 +1356,7 @@ // sockets. if (fState == LISTEN) return gSocketModule->count_connected(socket); - else if (fState == SYNCHRONIZE_SENT) + if (fState == SYNCHRONIZE_SENT) return 0; ssize_t availableData = fReceiveQueue.Available(); @@ -1375,26 +1383,27 @@ return false; return fState == ESTABLISHED || fState == FINISH_SENT - || fState == FINISH_ACKNOWLEDGED; + || fState == FINISH_ACKNOWLEDGED; } int32 TCPEndpoint::_Receive(tcp_segment_header &segment, net_buffer *buffer) { - uint32 advertisedWindow = (uint32)segment.advertised_window << fSendWindowShift; + uint32 advertisedWindow = (uint32)segment.advertised_window + << fSendWindowShift; size_t segmentLength = buffer->size; if (segment.flags & TCP_FLAG_RESET) { // is this a valid reset? if (fLastAcknowledgeSent <= segment.sequence - && tcp_sequence(segment.sequence) - < (fLastAcknowledgeSent + fReceiveWindow)) { + && tcp_sequence(segment.sequence) < (fLastAcknowledgeSent + + fReceiveWindow)) { if (fState == SYNCHRONIZE_RECEIVED) fError = ECONNREFUSED; else if (fState == CLOSING || fState == TIME_WAIT - || fState == WAIT_FOR_FINISH_ACKNOWLEDGE) + || fState == WAIT_FOR_FINISH_ACKNOWLEDGE) fError = ENOTCONN; else fError = ECONNRESET; @@ -1461,9 +1470,12 @@ gBufferModule->remove_trailer(buffer, drop); } - if (advertisedWindow > fSendWindow) +#ifdef TRACE_TCP + if (advertisedWindow > fSendWindow) { TRACE(" Receive(): Window update %lu -> %lu", fSendWindow, advertisedWindow); + } +#endif fSendWindow = advertisedWindow; if (advertisedWindow > fSendMaxWindow) @@ -1598,8 +1610,8 @@ if (fFlags & FLAG_OPTION_TIMESTAMP) { tcp_sequence sequence(segment.sequence); - if ((fLastAcknowledgeSent >= sequence - && fLastAcknowledgeSent < (sequence + segmentLength))) + if (fLastAcknowledgeSent >= sequence + && fLastAcknowledgeSent < (sequence + segmentLength)) fReceivedTimestamp = segment.timestamp_value; } } @@ -1793,8 +1805,8 @@ rtt -= (fRoundTripDeviation / 4); fRoundTripDeviation += rtt; - fRetransmitTimeout = ((fRoundTripTime / 4 + - fRoundTripDeviation) / 2) * kTimestampFactor; + fRetransmitTimeout = ((fRoundTripTime / 4 + fRoundTripDeviation) / 2) + * kTimestampFactor; TRACE(" RTO is now %llu (after rtt %ldms)", fRetransmitTimeout, roundTripTime); @@ -1813,11 +1825,10 @@ void TCPEndpoint::_DuplicateAcknowledge(tcp_segment_header &segment) { - fDuplicateAcknowledgeCount++; + if (++fDuplicateAcknowledgeCount < 3) + return; - if (fDuplicateAcknowledgeCount < 3) - return; - else if (fDuplicateAcknowledgeCount == 3) { + if (fDuplicateAcknowledgeCount == 3) { _ResetSlowStart(); fCongestionWindow = fSlowStartThreshold + 3 * fSendMaxSegmentSize; @@ -1876,9 +1887,6 @@ { TCPEndpoint *endpoint = (TCPEndpoint *)data; - if (mutex_lock(&endpoint->fLock) < B_OK) - return; - gSocketModule->delete_socket(endpoint->socket); } From axeld at mail.berlios.de Sat Jan 5 14:49:58 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 5 Jan 2008 14:49:58 +0100 Subject: [Haiku-commits] r23252 - haiku/trunk/src/bin/network/netstat Message-ID: <200801051349.m05Dnw5k004338@sheep.berlios.de> Author: axeld Date: 2008-01-05 14:49:57 +0100 (Sat, 05 Jan 2008) New Revision: 23252 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23252&view=rev Modified: haiku/trunk/src/bin/network/netstat/netstat.cpp Log: * Applied patch by James Woodcock: added '-n' option to disable resolving names. Thanks! Modified: haiku/trunk/src/bin/network/netstat/netstat.cpp =================================================================== --- haiku/trunk/src/bin/network/netstat/netstat.cpp 2008-01-05 13:45:31 UTC (rev 23251) +++ haiku/trunk/src/bin/network/netstat/netstat.cpp 2008-01-05 13:49:57 UTC (rev 23252) @@ -1,9 +1,10 @@ /* - * Copyright 2006, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: * Axel D?rfler, axeld at pinc-software.de + * James Woodcock */ @@ -22,11 +23,13 @@ #include #include #include +#include extern const char* __progname; const char* kProgramName = __progname; +static int sResolveNames = 1; struct address_family { int family; @@ -59,9 +62,13 @@ return; } - hostent* host = gethostbyaddr((const char*)&address.sin_addr, - sizeof(sockaddr_in), AF_INET); - servent* service = getservbyport(ntohs(address.sin_port), NULL); + hostent* host = NULL; + servent* service = NULL; + if (sResolveNames) { + host = gethostbyaddr((const char*)&address.sin_addr, sizeof(in_addr), + AF_INET); + service = getservbyport(ntohs(address.sin_port), NULL); + } const char *hostName; if (host != NULL) @@ -94,7 +101,10 @@ void usage(int status) { - printf("usage: %s\n", kProgramName); + printf("usage: %s [-nh]\n", kProgramName); + printf("options:\n"); + printf(" -n don't resolve names\n"); + printf(" -h this help\n"); exit(status); } @@ -141,20 +151,44 @@ int main(int argc, char** argv) { - if (argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h"))) - usage(0); + int optionIndex = 0; + int opt; + static struct option longOptions[] = { + {"help", no_argument, 0, 'h'}, + {"numeric", no_argument, 0, 'n'}, + {0, 0, 0, 0} + }; + do { + opt = getopt_long(argc, argv, "hn", longOptions, &optionIndex); + switch (opt) { + case -1: + // end of arguments, do nothing + break; + + case 'n': + sResolveNames = 0; + break; + + case 'h': + default: + usage(0); + break; + } + } while (opt != -1); + int stack = open(NET_STACK_DRIVER_PATH, O_RDWR); if (stack < 0) { - fprintf(stderr, "%s: The networking stack doesn't seem to be available.\n", - kProgramName); + fprintf(stderr, "%s: The networking stack doesn't seem to be " + "available.\n", kProgramName); return -1; } bool printProgram = true; - // TODO: add some program options... :-) + // TODO: add some more program options... :-) - printf("Proto Recv-Q Send-Q Local Address Foreign Address State Program\n"); + printf("Proto Recv-Q Send-Q Local Address Foreign Address " + "State Program\n"); uint32 cookie = 0; int family = -1; From korli at mail.berlios.de Sat Jan 5 15:18:10 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 5 Jan 2008 15:18:10 +0100 Subject: [Haiku-commits] r23253 - haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki Message-ID: <200801051418.m05EIA7F008327@sheep.berlios.de> Author: korli Date: 2008-01-05 15:18:10 +0100 (Sat, 05 Jan 2008) New Revision: 23253 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23253&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxkireg.h haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/io.c haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/io.h Log: added some more support for Audigy 2, untested Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c 2008-01-05 13:49:57 UTC (rev 23252) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c 2008-01-05 14:18:10 UTC (rev 23253) @@ -473,6 +473,11 @@ uint8 chano = chan->num; if(IS_AUDIGY(&card->config)) { + emuxki_chan_write(&card->config, chano, 0x4c, 0); + emuxki_chan_write(&card->config, chano, 0x4d, 0); + emuxki_chan_write(&card->config, chano, 0x4e, 0); + emuxki_chan_write(&card->config, chano, 0x4f, 0); + emuxki_chan_write(&card->config, chano, EMU_A_CHAN_FXRT1, (chan->fxsend.d.dest << 24) | (chan->fxsend.c.dest << 16) | @@ -1969,7 +1974,21 @@ emuxki_reg_write_32(&card->config, EMU_IPR, ipr); } - + + if(IS_AUDIGY2(&card->config)) { + while ((ipr = emuxki_reg_read_32(&card->config, EMU_A2_IPR2))) { + emuxki_reg_write_32(&card->config, EMU_A2_IPR2, ipr); + break; // avoid loop + } + + if (card->info.revision == 4) { + while ((ipr = emuxki_reg_read_32(&card->config, EMU_A2_IPR3))) { + emuxki_reg_write_32(&card->config, EMU_A2_IPR3, ipr); + break; // avoid loop + } + } + } + if(gotone) return B_INVOKE_SCHEDULER; @@ -2155,6 +2174,12 @@ } emuxki_reg_write_32(&card->config, EMU_INTE, EMU_INTE_SAMPLERATER | EMU_INTE_PCIERRENABLE); + if(IS_AUDIGY2(&card->config)) { + emuxki_reg_write_32(&card->config, EMU_A2_INTE2, 0); + if (card->info.revision == 4) { + emuxki_reg_write_32(&card->config, EMU_A2_INTE3, 0); + } + } PRINT(("installing interrupt : %lx\n", card->config.irq)); install_io_interrupt_handler(card->config.irq, emuxki_int, card, 0); @@ -2654,16 +2679,17 @@ if(IS_AUDIGY2(&card->config)) { emuxki_chan_write(&card->config, 0, EMU_A2_SPDIF_SAMPLERATE, EMU_A2_SPDIF_UNKNOWN); - emuxki_reg_write_32(&card->config, EMU_A2_PTR, EMU_A2_SRCSEL); - emuxki_reg_write_32(&card->config, EMU_A2_DATA, + emuxki_p16v_write(&card->config, 0, EMU_A2_SRCSEL, EMU_A2_SRCSEL_ENABLE_SPDIF | EMU_A2_SRCSEL_ENABLE_SRCMULTI); - + if (card->info.revision == 4) { - emuxki_reg_write_32(&card->config, EMU_A2_PTR, EMU_A2_SRCMULTI); - emuxki_reg_write_32(&card->config, EMU_A2_DATA, EMU_A2_SRCMULTI_ENABLE_INPUT); + emuxki_p16v_write(&card->config, 0, EMU_A2_SRCMULTI, EMU_A2_SRCMULTI_ENABLE_INPUT); } else { - emuxki_reg_write_32(&card->config, EMU_A2_PTR, EMU_A2_SRCMULTI2); - emuxki_reg_write_32(&card->config, EMU_A2_DATA, EMU_A2_SRCMULTI2_ENABLE_INPUT); + emuxki_p16v_write(&card->config, 0, EMU_A2_P17V_I2S, EMU_A2_P17V_I2S_ENABLE); + emuxki_p16v_write(&card->config, 0, EMU_A2_P17V_SPDIF, EMU_A2_P17V_SPDIF_ENABLE); + + emuxki_reg_write_32(&card->config, EMU_A_IOCFG, + emuxki_reg_read_32(&card->config, EMU_A_IOCFG) & ~0x8); } } Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxkireg.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxkireg.h 2008-01-05 13:49:57 UTC (rev 23252) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxkireg.h 2008-01-05 14:18:10 UTC (rev 23253) @@ -189,14 +189,21 @@ #define EMU_A2_PTR 0x20 #define EMU_A2_DATA 0x24 +#define EMU_A2_IPR2 0x28 +#define EMU_A2_INTE2 0x2c +#define EMU_A2_HCFG2 0x34 +#define EMU_A2_IPR3 0x38 +#define EMU_A2_INTE3 0x3c -#define EMU_A2_SRCSEL 0x600000 +#define EMU_A2_SRCSEL 0x60 #define EMU_A2_SRCSEL_ENABLE_SPDIF 0x00000004 #define EMU_A2_SRCSEL_ENABLE_SRCMULTI 0x00000010 -#define EMU_A2_SRCMULTI 0x6e0000 +#define EMU_A2_SRCMULTI 0x6e #define EMU_A2_SRCMULTI_ENABLE_INPUT 0xff00ff00 -#define EMU_A2_SRCMULTI2 0x7b0000 -#define EMU_A2_SRCMULTI2_ENABLE_INPUT 0xff000000 +#define EMU_A2_P17V_SPDIF 0x7a +#define EMU_A2_P17V_SPDIF_ENABLE 0xff000000 +#define EMU_A2_P17V_I2S 0x7b +#define EMU_A2_P17V_I2S_ENABLE 0xff000000 /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */ Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/io.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/io.c 2008-01-05 13:49:57 UTC (rev 23252) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/io.c 2008-01-05 14:18:10 UTC (rev 23253) @@ -226,3 +226,19 @@ emuxki_reg_write_32(config, EMU_INTE, emuxki_reg_read_32(config, EMU_INTE) & ~value); } + +/* p16v */ +uint32 +emuxki_p16v_read(device_config *config, uint16 chano, uint16 reg) +{ + emuxki_reg_write_32(config, EMU_A2_PTR, reg << 16 | chano); + return emuxki_reg_read_32(config, EMU_A2_DATA); +} + + +void +emuxki_p16v_write(device_config *config, uint16 chano, uint16 reg, uint32 data) +{ + emuxki_reg_write_32(config, EMU_A2_PTR, reg << 16 | chano); + emuxki_reg_write_32(config, EMU_A2_DATA, data); +} Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/io.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/io.h 2008-01-05 13:49:57 UTC (rev 23252) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/io.h 2008-01-05 14:18:10 UTC (rev 23253) @@ -57,5 +57,8 @@ void emuxki_inte_enable(device_config *config, uint32 value); void emuxki_inte_disable(device_config *config, uint32 value); - + +uint32 emuxki_p16v_read(device_config *config, uint16 chano, uint16 reg); +void emuxki_p16v_write(device_config *config, uint16 chano, uint16 reg, uint32 data); + #endif From marcusoverhagen at mail.berlios.de Sat Jan 5 15:53:39 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 5 Jan 2008 15:53:39 +0100 Subject: [Haiku-commits] r23254 - haiku/trunk/src/add-ons/kernel/busses/scsi/ahci Message-ID: <200801051453.m05Erd3h010479@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-05 15:53:38 +0100 (Sat, 05 Jan 2008) New Revision: 23254 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23254&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp Log: Fixed a copy&paste error. scsi_cmd_rw_10 has only a 16 bit length field, while scsi_cmd_rw_12 has a 32 bit field. As both are big endian, that error shouldn't have caused any problem or data corruption. Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 2008-01-05 14:18:10 UTC (rev 23253) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 2008-01-05 14:53:38 UTC (rev 23254) @@ -714,7 +714,7 @@ case SCSI_OP_READ_12: case SCSI_OP_WRITE_12: { - scsi_cmd_rw_10 *cmd = (scsi_cmd_rw_10 *)request->cdb; + scsi_cmd_rw_12 *cmd = (scsi_cmd_rw_12 *)request->cdb; uint32 position = B_BENDIAN_TO_HOST_INT32(cmd->lba); size_t length = B_BENDIAN_TO_HOST_INT32(cmd->length); bool isWrite = request->cdb[0] == SCSI_OP_WRITE_12; From marcusoverhagen at mail.berlios.de Sat Jan 5 16:19:17 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 5 Jan 2008 16:19:17 +0100 Subject: [Haiku-commits] r23255 - haiku/trunk/src/add-ons/kernel/busses/scsi/ahci Message-ID: <200801051519.m05FJHd4012003@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-05 16:19:10 +0100 (Sat, 05 Jan 2008) New Revision: 23255 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23255&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.h Log: Cleanup ccb->data_length handling. Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 2008-01-05 14:53:38 UTC (rev 23254) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 2008-01-05 15:19:10 UTC (rev 23255) @@ -401,11 +401,12 @@ TRACE("AHCIPort::ScsiInquiry port %d\n", fIndex); scsi_cmd_inquiry *cmd = (scsi_cmd_inquiry *)request->cdb; + scsi_res_inquiry scsiData; ata_res_identify_device ataData; ASSERT(sizeof(ataData) == 512); - if (cmd->evpd || cmd->page_code) { + if (cmd->evpd || cmd->page_code || request->data_length < sizeof(scsiData)) { TRACE("invalid request\n"); request->subsys_status = SCSI_REQ_ABORTED; gSCSI->finished(request, 1); @@ -432,7 +433,6 @@ } */ - scsi_res_inquiry scsiData; scsiData.device_type = scsi_dev_direct_access; scsiData.device_qualifier = scsi_periph_qual_connected; scsiData.device_type_modifier = 0; @@ -491,8 +491,7 @@ request->subsys_status = SCSI_DATA_RUN_ERR; } else { request->subsys_status = SCSI_REQ_CMP; - request->data_resid = request->data_length - sizeof(scsiData);// ??? - request->data_length = sizeof(scsiData); // ??? + request->data_resid = request->data_length - sizeof(scsiData); } gSCSI->finished(request, 1); } @@ -517,7 +516,7 @@ scsi_cmd_read_capacity *cmd = (scsi_cmd_read_capacity *)request->cdb; scsi_res_read_capacity scsiData; - if (cmd->pmi || cmd->lba) { + if (cmd->pmi || cmd->lba || request->data_length < sizeof(scsiData)) { TRACE("invalid request\n"); return; } @@ -534,18 +533,16 @@ request->subsys_status = SCSI_DATA_RUN_ERR; } else { request->subsys_status = SCSI_REQ_CMP; - request->data_resid = request->data_length - sizeof(scsiData);// ??? - request->data_length = sizeof(scsiData); // ??? + request->data_resid = request->data_length - sizeof(scsiData); } gSCSI->finished(request, 1); } void -AHCIPort::ScsiReadWrite(scsi_ccb *request, uint64 position, size_t length, bool isWrite) +AHCIPort::ScsiReadWrite(scsi_ccb *request, uint64 lba, size_t sectorCount, bool isWrite) { - uint32 bytecount = length * 512; - RWTRACE("ScsiReadWrite: position %llu, size %lu, isWrite %d\n", position * 512, bytecount, isWrite); + RWTRACE("ScsiReadWrite: position %llu, size %lu, isWrite %d\n", lba * 512, sectorCount * 512, isWrite); #if 0 if (isWrite) { @@ -556,22 +553,22 @@ return; } #endif - - request->data_length = bytecount; // XXX really? + + ASSERT(request->data_length == sectorCount * 512); sata_request *sreq = new sata_request(request); if (fUse48BitCommands) { - if (length > 65536) - panic("ahci: ScsiReadWrite length too large, %lu sectors", length); - if (position > MAX_SECTOR_LBA_48) + if (sectorCount > 65536) + panic("ahci: ScsiReadWrite length too large, %lu sectors", sectorCount); + if (lba > MAX_SECTOR_LBA_48) panic("achi: ScsiReadWrite position too large for 48-bit LBA\n"); - sreq->set_ata48_cmd(isWrite ? 0x35 : 0x25, position, length); + sreq->set_ata48_cmd(isWrite ? 0x35 : 0x25, lba, sectorCount); } else { - if (length > 256) - panic("ahci: ScsiReadWrite length too large, %lu sectors", length); - if (position > MAX_SECTOR_LBA_28) + if (sectorCount > 256) + panic("ahci: ScsiReadWrite length too large, %lu sectors", sectorCount); + if (lba > MAX_SECTOR_LBA_28) panic("achi: ScsiReadWrite position too large for normal LBA\n"); - sreq->set_ata28_cmd(isWrite ? 0xca : 0xc8, position, length); + sreq->set_ata28_cmd(isWrite ? 0xca : 0xc8, lba, sectorCount); } ExecuteSataRequest(sreq, isWrite); Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.h 2008-01-05 14:53:38 UTC (rev 23254) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.h 2008-01-05 15:19:10 UTC (rev 23255) @@ -32,7 +32,7 @@ void ScsiTestUnitReady(scsi_ccb *request); void ScsiInquiry(scsi_ccb *request); void ScsiReadCapacity(scsi_ccb *request); - void ScsiReadWrite(scsi_ccb *request, uint64 position, size_t length, bool isWrite); + void ScsiReadWrite(scsi_ccb *request, uint64 lba, size_t sectorCount, bool isWrite); void ScsiSynchronizeCache(scsi_ccb *request); void ExecuteSataRequest(sata_request *request, bool isWrite = false); From marcusoverhagen at mail.berlios.de Sat Jan 5 16:35:48 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 5 Jan 2008 16:35:48 +0100 Subject: [Haiku-commits] r23256 - haiku/trunk/src/add-ons/kernel/busses/scsi/ahci Message-ID: <200801051535.m05FZmdu013987@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-05 16:35:48 +0100 (Sat, 05 Jan 2008) New Revision: 23256 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23256&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp Log: Marked some bits as RWC and RW1. Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h 2008-01-05 15:19:10 UTC (rev 23255) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_defs.h 2008-01-05 15:35:48 UTC (rev 23256) @@ -15,6 +15,10 @@ #define AHCI_DEVICE_MODULE_NAME "busses/scsi/ahci/device_v1" #define AHCI_SIM_MODULE_NAME "busses/scsi/ahci/sim/v1" +// RW1 = Write 1 to set bit (writing 0 is ignored) +// RWC = Write 1 to clear bit (writing 0 is ignored) + + enum { CAP_S64A = (1 << 31), // Supports 64-bit Addressing CAP_SNCQ = (1 << 30), // Supports Native Command Queuing @@ -47,7 +51,7 @@ GHC_AE = (1 << 31), // AHCI Enable GHC_MRSM = (1 << 2), // MSI Revert to Single Message GHC_IE = (1 << 1), // Interrupt Enable - GHC_HR = (1 << 0), // HBA Reset + GHC_HR = (1 << 0), // HBA Reset **RW1** }; @@ -77,7 +81,7 @@ uint32 clbu; // Command List Base Address Upper 32-Bits uint32 fb; // FIS Base Address (alignment 256 byte) uint32 fbu; // FIS Base Address Upper 32-Bits - uint32 is; // Interrupt Status + uint32 is; // Interrupt Status **RWC** uint32 ie; // Interrupt Enable uint32 cmd; // Command and Status uint32 res1; // Reserved @@ -85,9 +89,9 @@ uint32 sig; // Signature uint32 ssts; // Serial ATA Status (SCR0: SStatus) uint32 sctl; // Serial ATA Control (SCR2: SControl) - uint32 serr; // Serial ATA Error (SCR1: SError) - uint32 sact; // Serial ATA Active (SCR3: SActive) - uint32 ci; // Command Issue + uint32 serr; // Serial ATA Error (SCR1: SError) **RWC** + uint32 sact; // Serial ATA Active (SCR3: SActive) **RW1** + uint32 ci; // Command Issue **RW1** uint32 sntf; // SNotification uint32 res2; // Reserved for FIS-based Switching Definition uint32 res[11]; // Reserved Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 2008-01-05 15:19:10 UTC (rev 23255) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 2008-01-05 15:35:48 UTC (rev 23256) @@ -610,7 +610,7 @@ cpu_status cpu = disable_interrupts(); acquire_spinlock(&fSpinlock); - fRegs->ci |= 1; + fRegs->ci = 1; FlushPostedWrites(); fCommandsActive |= 1; release_spinlock(&fSpinlock); From korli at mail.berlios.de Sat Jan 5 16:49:22 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 5 Jan 2008 16:49:22 +0100 Subject: [Haiku-commits] r23257 - in haiku/vendor/mesa/current: glu/libutil headers/public src/glapi src/main src/shader src/shader/slang/library src/sparc src/swrast src/swrast_setup src/tnl src/vbo src/x86 src/x86/rtasm src/x86-64 Message-ID: <200801051549.m05FnM5o014627@sheep.berlios.de> Author: korli Date: 2008-01-05 16:49:17 +0100 (Sat, 05 Jan 2008) New Revision: 23257 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23257&view=rev Removed: haiku/vendor/mesa/current/src/shader/slang/library/slang_builtin_120_common_gc.h haiku/vendor/mesa/current/src/shader/slang/library/slang_builtin_120_fragment_gc.h haiku/vendor/mesa/current/src/x86-64/matypes.h Modified: haiku/vendor/mesa/current/glu/libutil/project.c haiku/vendor/mesa/current/headers/public/glu.h haiku/vendor/mesa/current/src/glapi/dispatch.h haiku/vendor/mesa/current/src/glapi/glapioffsets.h haiku/vendor/mesa/current/src/glapi/glapitable.h haiku/vendor/mesa/current/src/glapi/glapitemp.h haiku/vendor/mesa/current/src/glapi/glprocs.h haiku/vendor/mesa/current/src/main/api_validate.c haiku/vendor/mesa/current/src/main/attrib.c haiku/vendor/mesa/current/src/main/attrib.h haiku/vendor/mesa/current/src/main/context.c haiku/vendor/mesa/current/src/main/dlist.c haiku/vendor/mesa/current/src/main/enable.c haiku/vendor/mesa/current/src/main/enums.c haiku/vendor/mesa/current/src/main/fbobject.c haiku/vendor/mesa/current/src/main/framebuffer.c haiku/vendor/mesa/current/src/main/glheader.h haiku/vendor/mesa/current/src/main/image.c haiku/vendor/mesa/current/src/main/light.c haiku/vendor/mesa/current/src/main/lines.c haiku/vendor/mesa/current/src/main/mtypes.h haiku/vendor/mesa/current/src/main/points.c haiku/vendor/mesa/current/src/main/polygon.c haiku/vendor/mesa/current/src/main/state.c haiku/vendor/mesa/current/src/main/stencil.c haiku/vendor/mesa/current/src/main/stencil.h haiku/vendor/mesa/current/src/main/texenvprogram.c haiku/vendor/mesa/current/src/main/texobj.c haiku/vendor/mesa/current/src/main/texobj.h haiku/vendor/mesa/current/src/main/texstate.c haiku/vendor/mesa/current/src/main/version.h haiku/vendor/mesa/current/src/shader/arbprogparse.c haiku/vendor/mesa/current/src/shader/atifragshader.c haiku/vendor/mesa/current/src/shader/prog_statevars.c haiku/vendor/mesa/current/src/shader/shader_api.c haiku/vendor/mesa/current/src/sparc/glapi_sparc.S haiku/vendor/mesa/current/src/swrast/s_copypix.c haiku/vendor/mesa/current/src/swrast/s_pointtemp.h haiku/vendor/mesa/current/src/swrast/s_span.c haiku/vendor/mesa/current/src/swrast_setup/ss_tritmp.h haiku/vendor/mesa/current/src/tnl/t_draw.c haiku/vendor/mesa/current/src/tnl/t_vb_fog.c haiku/vendor/mesa/current/src/tnl/t_vertex_sse.c haiku/vendor/mesa/current/src/tnl/t_vp_build.c haiku/vendor/mesa/current/src/vbo/vbo_save_draw.c haiku/vendor/mesa/current/src/vbo/vbo_split_copy.c haiku/vendor/mesa/current/src/x86-64/glapi_x86-64.S haiku/vendor/mesa/current/src/x86-64/xform4.S haiku/vendor/mesa/current/src/x86/glapi_x86.S haiku/vendor/mesa/current/src/x86/matypes.h haiku/vendor/mesa/current/src/x86/read_rgba_span_x86.S haiku/vendor/mesa/current/src/x86/rtasm/x86sse.c haiku/vendor/mesa/current/src/x86/rtasm/x86sse.h Log: updating mesa vendor with version 7.0.2 Modified: haiku/vendor/mesa/current/glu/libutil/project.c =================================================================== --- haiku/vendor/mesa/current/glu/libutil/project.c 2008-01-05 15:35:48 UTC (rev 23256) +++ haiku/vendor/mesa/current/glu/libutil/project.c 2008-01-05 15:49:17 UTC (rev 23257) @@ -168,74 +168,57 @@ } /* -** inverse = invert(src) -** New, faster implementation by Shan Hao Bo, April 2006. +** Invert 4x4 matrix. +** Contributed by David Moore (See Mesa bug #6748) */ -static int __gluInvertMatrixd(const GLdouble src[16], GLdouble inverse[16]) +static int __gluInvertMatrixd(const GLdouble m[16], GLdouble invOut[16]) { - int i, j, k; - double t; - GLdouble temp[4][4]; - - for (i=0; i<4; i++) { - for (j=0; j<4; j++) { - temp[i][j] = src[i*4+j]; - } - } - __gluMakeIdentityd(inverse); - - for (i = 0; i < 4; i++) { - if (temp[i][i] == 0.0f) { - /* - ** Look for non-zero element in column - */ - for (j = i + 1; j < 4; j++) { - if (temp[j][i] != 0.0f) { - break; - } - } - - if (j != 4) { - /* - ** Swap rows. - */ - for (k = 0; k < 4; k++) { - t = temp[i][k]; - temp[i][k] = temp[j][k]; - temp[j][k] = t; - - t = inverse[i*4+k]; - inverse[i*4+k] = inverse[j*4+k]; - inverse[j*4+k] = t; - } - } - else { - /* - ** No non-zero pivot. The matrix is singular, -which shouldn't - ** happen. This means the user gave us a bad -matrix. - */ - return GL_FALSE; - } - } - - t = 1.0f / temp[i][i]; - for (k = 0; k < 4; k++) { - temp[i][k] *= t; - inverse[i*4+k] *= t; - } - for (j = 0; j < 4; j++) { - if (j != i) { - t = temp[j][i]; - for (k = 0; k < 4; k++) { - temp[j][k] -= temp[i][k]*t; - inverse[j*4+k] -= inverse[i*4+k]*t; - } - } - } - } - return GL_TRUE; + double inv[16], det; + int i; + + inv[0] = m[5]*m[10]*m[15] - m[5]*m[11]*m[14] - m[9]*m[6]*m[15] + + m[9]*m[7]*m[14] + m[13]*m[6]*m[11] - m[13]*m[7]*m[10]; + inv[4] = -m[4]*m[10]*m[15] + m[4]*m[11]*m[14] + m[8]*m[6]*m[15] + - m[8]*m[7]*m[14] - m[12]*m[6]*m[11] + m[12]*m[7]*m[10]; + inv[8] = m[4]*m[9]*m[15] - m[4]*m[11]*m[13] - m[8]*m[5]*m[15] + + m[8]*m[7]*m[13] + m[12]*m[5]*m[11] - m[12]*m[7]*m[9]; + inv[12] = -m[4]*m[9]*m[14] + m[4]*m[10]*m[13] + m[8]*m[5]*m[14] + - m[8]*m[6]*m[13] - m[12]*m[5]*m[10] + m[12]*m[6]*m[9]; + inv[1] = -m[1]*m[10]*m[15] + m[1]*m[11]*m[14] + m[9]*m[2]*m[15] + - m[9]*m[3]*m[14] - m[13]*m[2]*m[11] + m[13]*m[3]*m[10]; + inv[5] = m[0]*m[10]*m[15] - m[0]*m[11]*m[14] - m[8]*m[2]*m[15] + + m[8]*m[3]*m[14] + m[12]*m[2]*m[11] - m[12]*m[3]*m[10]; + inv[9] = -m[0]*m[9]*m[15] + m[0]*m[11]*m[13] + m[8]*m[1]*m[15] + - m[8]*m[3]*m[13] - m[12]*m[1]*m[11] + m[12]*m[3]*m[9]; + inv[13] = m[0]*m[9]*m[14] - m[0]*m[10]*m[13] - m[8]*m[1]*m[14] + + m[8]*m[2]*m[13] + m[12]*m[1]*m[10] - m[12]*m[2]*m[9]; + inv[2] = m[1]*m[6]*m[15] - m[1]*m[7]*m[14] - m[5]*m[2]*m[15] + + m[5]*m[3]*m[14] + m[13]*m[2]*m[7] - m[13]*m[3]*m[6]; + inv[6] = -m[0]*m[6]*m[15] + m[0]*m[7]*m[14] + m[4]*m[2]*m[15] + - m[4]*m[3]*m[14] - m[12]*m[2]*m[7] + m[12]*m[3]*m[6]; + inv[10] = m[0]*m[5]*m[15] - m[0]*m[7]*m[13] - m[4]*m[1]*m[15] + + m[4]*m[3]*m[13] + m[12]*m[1]*m[7] - m[12]*m[3]*m[5]; + inv[14] = -m[0]*m[5]*m[14] + m[0]*m[6]*m[13] + m[4]*m[1]*m[14] + - m[4]*m[2]*m[13] - m[12]*m[1]*m[6] + m[12]*m[2]*m[5]; + inv[3] = -m[1]*m[6]*m[11] + m[1]*m[7]*m[10] + m[5]*m[2]*m[11] + - m[5]*m[3]*m[10] - m[9]*m[2]*m[7] + m[9]*m[3]*m[6]; + inv[7] = m[0]*m[6]*m[11] - m[0]*m[7]*m[10] - m[4]*m[2]*m[11] + + m[4]*m[3]*m[10] + m[8]*m[2]*m[7] - m[8]*m[3]*m[6]; + inv[11] = -m[0]*m[5]*m[11] + m[0]*m[7]*m[9] + m[4]*m[1]*m[11] + - m[4]*m[3]*m[9] - m[8]*m[1]*m[7] + m[8]*m[3]*m[5]; + inv[15] = m[0]*m[5]*m[10] - m[0]*m[6]*m[9] - m[4]*m[1]*m[10] + + m[4]*m[2]*m[9] + m[8]*m[1]*m[6] - m[8]*m[2]*m[5]; + + det = m[0]*inv[0] + m[1]*inv[4] + m[2]*inv[8] + m[3]*inv[12]; + if (det == 0) + return GL_FALSE; + + det = 1.0 / det; + + for (i = 0; i < 16; i++) + invOut[i] = inv[i] * det; + + return GL_TRUE; } static void __gluMultMatricesd(const GLdouble a[16], const GLdouble b[16], Modified: haiku/vendor/mesa/current/headers/public/glu.h =================================================================== --- haiku/vendor/mesa/current/headers/public/glu.h 2008-01-05 15:35:48 UTC (rev 23256) +++ haiku/vendor/mesa/current/headers/public/glu.h 2008-01-05 15:49:17 UTC (rev 23257) @@ -44,23 +44,18 @@ #define GLAPIENTRYP GLAPIENTRY * #endif -#ifdef GLAPI -#undef GLAPI -#endif +#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32) +# undef GLAPI +# define GLAPI __declspec(dllexport) +#elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) +/* tag specifying we're building for DLL runtime support */ +# undef GLAPI +# define GLAPI __declspec(dllimport) +#elif !defined(GLAPI) +/* for use with static link lib build of Win32 edition only */ +# define GLAPI extern +#endif /* _STATIC_MESA support */ -# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32) -# define GLAPI __declspec(dllexport) -# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ -# define GLAPI __declspec(dllimport) -# else /* for use with static link lib build of Win32 edition only */ -# define GLAPI extern -# endif /* _STATIC_MESA support */ - - -#ifndef GLAPI -#define GLAPI -#endif - #ifdef __cplusplus extern "C" { #endif Modified: haiku/vendor/mesa/current/src/glapi/dispatch.h =================================================================== --- haiku/vendor/mesa/current/src/glapi/dispatch.h 2008-01-05 15:35:48 UTC (rev 23256) +++ haiku/vendor/mesa/current/src/glapi/dispatch.h 2008-01-05 15:49:17 UTC (rev 23257) @@ -2362,6 +2362,9 @@ #define CALL_BlitFramebufferEXT(disp, parameters) (*((disp)->BlitFramebufferEXT)) parameters #define GET_BlitFramebufferEXT(disp) ((disp)->BlitFramebufferEXT) #define SET_BlitFramebufferEXT(disp, fn) ((disp)->BlitFramebufferEXT = fn) +#define CALL_StencilFuncSeparateATI(disp, parameters) (*((disp)->StencilFuncSeparateATI)) parameters +#define GET_StencilFuncSeparateATI(disp) ((disp)->StencilFuncSeparateATI) +#define SET_StencilFuncSeparateATI(disp, fn) ((disp)->StencilFuncSeparateATI = fn) #define CALL_ProgramEnvParameters4fvEXT(disp, parameters) (*((disp)->ProgramEnvParameters4fvEXT)) parameters #define GET_ProgramEnvParameters4fvEXT(disp) ((disp)->ProgramEnvParameters4fvEXT) #define SET_ProgramEnvParameters4fvEXT(disp, fn) ((disp)->ProgramEnvParameters4fvEXT = fn) @@ -2377,7 +2380,7 @@ #else -#define driDispatchRemapTable_size 364 +#define driDispatchRemapTable_size 365 extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define AttachShader_remap_index 0 @@ -2740,10 +2743,11 @@ #define IsRenderbufferEXT_remap_index 357 #define RenderbufferStorageEXT_remap_index 358 #define BlitFramebufferEXT_remap_index 359 -#define ProgramEnvParameters4fvEXT_remap_index 360 -#define ProgramLocalParameters4fvEXT_remap_index 361 -#define GetQueryObjecti64vEXT_remap_index 362 -#define GetQueryObjectui64vEXT_remap_index 363 +#define StencilFuncSeparateATI_remap_index 360 +#define ProgramEnvParameters4fvEXT_remap_index 361 +#define ProgramLocalParameters4fvEXT_remap_index 362 +#define GetQueryObjecti64vEXT_remap_index 363 +#define GetQueryObjectui64vEXT_remap_index 364 #define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters) #define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index]) @@ -3825,6 +3829,9 @@ #define CALL_BlitFramebufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum)), driDispatchRemapTable[BlitFramebufferEXT_remap_index], parameters) #define GET_BlitFramebufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BlitFramebufferEXT_remap_index]) #define SET_BlitFramebufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BlitFramebufferEXT_remap_index], fn) +#define CALL_StencilFuncSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparateATI_remap_index], parameters) +#define GET_StencilFuncSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index]) +#define SET_StencilFuncSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index], fn) #define CALL_ProgramEnvParameters4fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], parameters) #define GET_ProgramEnvParameters4fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index]) #define SET_ProgramEnvParameters4fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], fn) Modified: haiku/vendor/mesa/current/src/glapi/glapioffsets.h =================================================================== --- haiku/vendor/mesa/current/src/glapi/glapioffsets.h 2008-01-05 15:35:48 UTC (rev 23256) +++ haiku/vendor/mesa/current/src/glapi/glapioffsets.h 2008-01-05 15:49:17 UTC (rev 23257) @@ -800,11 +800,12 @@ #define _gloffset_IsRenderbufferEXT 765 #define _gloffset_RenderbufferStorageEXT 766 #define _gloffset_BlitFramebufferEXT 767 -#define _gloffset_ProgramEnvParameters4fvEXT 768 -#define _gloffset_ProgramLocalParameters4fvEXT 769 -#define _gloffset_GetQueryObjecti64vEXT 770 -#define _gloffset_GetQueryObjectui64vEXT 771 -#define _gloffset_FIRST_DYNAMIC 772 +#define _gloffset_StencilFuncSeparateATI 768 +#define _gloffset_ProgramEnvParameters4fvEXT 769 +#define _gloffset_ProgramLocalParameters4fvEXT 770 +#define _gloffset_GetQueryObjecti64vEXT 771 +#define _gloffset_GetQueryObjectui64vEXT 772 +#define _gloffset_FIRST_DYNAMIC 773 #else @@ -1168,6 +1169,7 @@ #define _gloffset_IsRenderbufferEXT driDispatchRemapTable[IsRenderbufferEXT_remap_index] #define _gloffset_RenderbufferStorageEXT driDispatchRemapTable[RenderbufferStorageEXT_remap_index] #define _gloffset_BlitFramebufferEXT driDispatchRemapTable[BlitFramebufferEXT_remap_index] +#define _gloffset_StencilFuncSeparateATI driDispatchRemapTable[StencilFuncSeparateATI_remap_index] #define _gloffset_ProgramEnvParameters4fvEXT driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index] #define _gloffset_ProgramLocalParameters4fvEXT driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index] #define _gloffset_GetQueryObjecti64vEXT driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index] Modified: haiku/vendor/mesa/current/src/glapi/glapitable.h =================================================================== --- haiku/vendor/mesa/current/src/glapi/glapitable.h 2008-01-05 15:35:48 UTC (rev 23256) +++ haiku/vendor/mesa/current/src/glapi/glapitable.h 2008-01-05 15:49:17 UTC (rev 23257) @@ -464,7 +464,7 @@ GLboolean (GLAPIENTRYP IsShader)(GLuint shader); /* 420 */ void (GLAPIENTRYP StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); /* 421 */ void (GLAPIENTRYP StencilMaskSeparate)(GLenum face, GLuint mask); /* 422 */ - void (GLAPIENTRYP StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); /* 423 */ + void (GLAPIENTRYP StencilOpSeparate)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); /* 423 */ void (GLAPIENTRYP UniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 424 */ void (GLAPIENTRYP UniformMatrix2x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 425 */ void (GLAPIENTRYP UniformMatrix3x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 426 */ @@ -809,10 +809,11 @@ GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 765 */ void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 766 */ void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 767 */ - void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 768 */ - void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 769 */ - void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 770 */ - void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 771 */ + void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 768 */ + void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 769 */ + void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 770 */ + void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 771 */ + void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 772 */ }; #endif /* !defined( _GLAPI_TABLE_H_ ) */ Modified: haiku/vendor/mesa/current/src/glapi/glapitemp.h =================================================================== --- haiku/vendor/mesa/current/src/glapi/glapitemp.h 2008-01-05 15:35:48 UTC (rev 23256) +++ haiku/vendor/mesa/current/src/glapi/glapitemp.h 2008-01-05 15:49:17 UTC (rev 23257) @@ -2754,11 +2754,18 @@ DISPATCH(StencilMaskSeparate, (face, mask), (F, "glStencilMaskSeparate(0x%x, %d);\n", face, mask)); } -KEYWORD1 void KEYWORD2 NAME(StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +KEYWORD1 void KEYWORD2 NAME(StencilOpSeparate)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) { - DISPATCH(StencilOpSeparate, (face, fail, zfail, zpass), (F, "glStencilOpSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", face, fail, zfail, zpass)); + DISPATCH(StencilOpSeparate, (face, sfail, zfail, zpass), (F, "glStencilOpSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", face, sfail, zfail, zpass)); } +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_423)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_423)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) +{ + DISPATCH(StencilOpSeparate, (face, sfail, zfail, zpass), (F, "glStencilOpSeparateATI(0x%x, 0x%x, 0x%x, 0x%x);\n", face, sfail, zfail, zpass)); +} + KEYWORD1 void KEYWORD2 NAME(UniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { DISPATCH(UniformMatrix2x3fv, (location, count, transpose, value), (F, "glUniformMatrix2x3fv(%d, %d, %d, %p);\n", location, count, transpose, (const void *) value)); @@ -5441,30 +5448,37 @@ DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebufferEXT(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) { - DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); + DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask)); } KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { + DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); +} + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +{ DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLuint id, GLenum pname, GLint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLuint id, GLenum pname, GLint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLuint id, GLenum pname, GLint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLuint id, GLenum pname, GLint64EXT * params) { DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLuint id, GLenum pname, GLuint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLuint id, GLenum pname, GLuint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLuint id, GLenum pname, GLuint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLuint id, GLenum pname, GLuint64EXT * params) { DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } @@ -6255,6 +6269,7 @@ TABLE_ENTRY(_dispatch_stub_769), TABLE_ENTRY(_dispatch_stub_770), TABLE_ENTRY(_dispatch_stub_771), + TABLE_ENTRY(_dispatch_stub_772), /* A whole bunch of no-op functions. These might be called * when someone tries to call a dynamically-registered * extension function without a current rendering context. Modified: haiku/vendor/mesa/current/src/glapi/glprocs.h =================================================================== --- haiku/vendor/mesa/current/src/glapi/glprocs.h 2008-01-05 15:35:48 UTC (rev 23256) +++ haiku/vendor/mesa/current/src/glapi/glprocs.h 2008-01-05 15:49:17 UTC (rev 23257) @@ -820,6 +820,7 @@ "glIsRenderbufferEXT\0" "glRenderbufferStorageEXT\0" "glBlitFramebufferEXT\0" + "glStencilFuncSeparateATI\0" "glProgramEnvParameters4fvEXT\0" "glProgramLocalParameters4fvEXT\0" "glGetQueryObjecti64vEXT\0" @@ -915,6 +916,7 @@ "glMultiTexCoord4iv\0" "glMultiTexCoord4s\0" "glMultiTexCoord4sv\0" + "glStencilOpSeparateATI\0" "glLoadTransposeMatrixd\0" "glLoadTransposeMatrixf\0" "glMultTransposeMatrixd\0" @@ -1147,6 +1149,7 @@ #define gl_dispatch_stub_769 mgl_dispatch_stub_769 #define gl_dispatch_stub_770 mgl_dispatch_stub_770 #define gl_dispatch_stub_771 mgl_dispatch_stub_771 +#define gl_dispatch_stub_772 mgl_dispatch_stub_772 #endif /* USE_MGL_NAMESPACE */ @@ -1197,6 +1200,7 @@ extern void gl_dispatch_stub_769(void); extern void gl_dispatch_stub_770(void); extern void gl_dispatch_stub_771(void); +extern void gl_dispatch_stub_772(void); #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */ static const glprocs_table_t static_functions[] = { @@ -1968,284 +1972,286 @@ NAME_FUNC_OFFSET(13404, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), NAME_FUNC_OFFSET(13424, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), NAME_FUNC_OFFSET(13449, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_BlitFramebufferEXT), - NAME_FUNC_OFFSET(13470, gl_dispatch_stub_768, gl_dispatch_stub_768, NULL, _gloffset_ProgramEnvParameters4fvEXT), - NAME_FUNC_OFFSET(13499, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_ProgramLocalParameters4fvEXT), - NAME_FUNC_OFFSET(13530, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_GetQueryObjecti64vEXT), - NAME_FUNC_OFFSET(13554, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_GetQueryObjectui64vEXT), - NAME_FUNC_OFFSET(13579, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), - NAME_FUNC_OFFSET(13597, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), - NAME_FUNC_OFFSET(13614, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), - NAME_FUNC_OFFSET(13630, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), - NAME_FUNC_OFFSET(13655, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), - NAME_FUNC_OFFSET(13675, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), - NAME_FUNC_OFFSET(13695, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), - NAME_FUNC_OFFSET(13718, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), - NAME_FUNC_OFFSET(13741, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), - NAME_FUNC_OFFSET(13761, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), - NAME_FUNC_OFFSET(13778, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), - NAME_FUNC_OFFSET(13795, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), - NAME_FUNC_OFFSET(13810, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), - NAME_FUNC_OFFSET(13834, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), - NAME_FUNC_OFFSET(13853, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), - NAME_FUNC_OFFSET(13872, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), - NAME_FUNC_OFFSET(13888, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), - NAME_FUNC_OFFSET(13907, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), - NAME_FUNC_OFFSET(13930, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(13946, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(13962, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), - NAME_FUNC_OFFSET(13989, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), - NAME_FUNC_OFFSET(14016, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), - NAME_FUNC_OFFSET(14036, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14055, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14074, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14104, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14134, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14164, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14194, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), - NAME_FUNC_OFFSET(14213, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), - NAME_FUNC_OFFSET(14236, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), - NAME_FUNC_OFFSET(14261, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), - NAME_FUNC_OFFSET(14286, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), - NAME_FUNC_OFFSET(14313, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), - NAME_FUNC_OFFSET(14341, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), - NAME_FUNC_OFFSET(14368, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), - NAME_FUNC_OFFSET(14396, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), - NAME_FUNC_OFFSET(14425, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), - NAME_FUNC_OFFSET(14454, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), - NAME_FUNC_OFFSET(14480, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), - NAME_FUNC_OFFSET(14511, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), - NAME_FUNC_OFFSET(14542, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), - NAME_FUNC_OFFSET(14566, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), - NAME_FUNC_OFFSET(14589, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), - NAME_FUNC_OFFSET(14607, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), - NAME_FUNC_OFFSET(14636, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), - NAME_FUNC_OFFSET(14665, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), - NAME_FUNC_OFFSET(14680, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), - NAME_FUNC_OFFSET(14706, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), - NAME_FUNC_OFFSET(14732, glHistogram, glHistogram, NULL, _gloffset_Histogram), - NAME_FUNC_OFFSET(14747, glMinmax, glMinmax, NULL, _gloffset_Minmax), - NAME_FUNC_OFFSET(14759, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), - NAME_FUNC_OFFSET(14779, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), - NAME_FUNC_OFFSET(14796, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), - NAME_FUNC_OFFSET(14812, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), - NAME_FUNC_OFFSET(14831, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), - NAME_FUNC_OFFSET(14854, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), - NAME_FUNC_OFFSET(14870, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), - NAME_FUNC_OFFSET(14892, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), - NAME_FUNC_OFFSET(14910, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), - NAME_FUNC_OFFSET(14929, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), - NAME_FUNC_OFFSET(14947, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), - NAME_FUNC_OFFSET(14966, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), - NAME_FUNC_OFFSET(14984, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), - NAME_FUNC_OFFSET(15003, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), - NAME_FUNC_OFFSET(15021, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), - NAME_FUNC_OFFSET(15040, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), - NAME_FUNC_OFFSET(15058, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), - NAME_FUNC_OFFSET(15077, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), - NAME_FUNC_OFFSET(15095, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), - NAME_FUNC_OFFSET(15114, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), - NAME_FUNC_OFFSET(15132, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), - NAME_FUNC_OFFSET(15151, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), - NAME_FUNC_OFFSET(15169, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), - NAME_FUNC_OFFSET(15188, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), - NAME_FUNC_OFFSET(15206, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), - NAME_FUNC_OFFSET(15225, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), - NAME_FUNC_OFFSET(15243, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), - NAME_FUNC_OFFSET(15262, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), - NAME_FUNC_OFFSET(15280, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), - NAME_FUNC_OFFSET(15299, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), - NAME_FUNC_OFFSET(15317, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), - NAME_FUNC_OFFSET(15336, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), - NAME_FUNC_OFFSET(15354, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), - NAME_FUNC_OFFSET(15373, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), - NAME_FUNC_OFFSET(15391, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), - NAME_FUNC_OFFSET(15410, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), - NAME_FUNC_OFFSET(15428, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), - NAME_FUNC_OFFSET(15447, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), - NAME_FUNC_OFFSET(15465, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), - NAME_FUNC_OFFSET(15484, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), - NAME_FUNC_OFFSET(15507, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), - NAME_FUNC_OFFSET(15530, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), - NAME_FUNC_OFFSET(15553, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), - NAME_FUNC_OFFSET(15576, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), - NAME_FUNC_OFFSET(15593, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), - NAME_FUNC_OFFSET(15616, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), - NAME_FUNC_OFFSET(15639, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), - NAME_FUNC_OFFSET(15662, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), - NAME_FUNC_OFFSET(15688, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), - NAME_FUNC_OFFSET(15714, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), - NAME_FUNC_OFFSET(15740, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), - NAME_FUNC_OFFSET(15764, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), - NAME_FUNC_OFFSET(15791, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), - NAME_FUNC_OFFSET(15817, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), - NAME_FUNC_OFFSET(15837, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), - NAME_FUNC_OFFSET(15857, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), - NAME_FUNC_OFFSET(15877, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), - NAME_FUNC_OFFSET(15894, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), - NAME_FUNC_OFFSET(15912, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), - NAME_FUNC_OFFSET(15929, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), - NAME_FUNC_OFFSET(15947, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), - NAME_FUNC_OFFSET(15964, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), - NAME_FUNC_OFFSET(15982, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), - NAME_FUNC_OFFSET(15999, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), - NAME_FUNC_OFFSET(16017, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), - NAME_FUNC_OFFSET(16034, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), - NAME_FUNC_OFFSET(16052, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), - NAME_FUNC_OFFSET(16069, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), - NAME_FUNC_OFFSET(16087, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), - NAME_FUNC_OFFSET(16104, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), - NAME_FUNC_OFFSET(16122, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), - NAME_FUNC_OFFSET(16139, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), - NAME_FUNC_OFFSET(16157, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), - NAME_FUNC_OFFSET(16174, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), - NAME_FUNC_OFFSET(16192, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), - NAME_FUNC_OFFSET(16211, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), - NAME_FUNC_OFFSET(16230, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), - NAME_FUNC_OFFSET(16249, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), - NAME_FUNC_OFFSET(16268, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), - NAME_FUNC_OFFSET(16288, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), - NAME_FUNC_OFFSET(16308, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), - NAME_FUNC_OFFSET(16328, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), - NAME_FUNC_OFFSET(16346, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), - NAME_FUNC_OFFSET(16363, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), - NAME_FUNC_OFFSET(16381, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), - NAME_FUNC_OFFSET(16398, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), - NAME_FUNC_OFFSET(16416, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), - NAME_FUNC_OFFSET(16434, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), - NAME_FUNC_OFFSET(16451, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), - NAME_FUNC_OFFSET(16469, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), - NAME_FUNC_OFFSET(16488, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), - NAME_FUNC_OFFSET(16507, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), - NAME_FUNC_OFFSET(16526, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), - NAME_FUNC_OFFSET(16548, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), - NAME_FUNC_OFFSET(16561, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), - NAME_FUNC_OFFSET(16574, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), - NAME_FUNC_OFFSET(16590, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), - NAME_FUNC_OFFSET(16606, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), - NAME_FUNC_OFFSET(16619, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), - NAME_FUNC_OFFSET(16642, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), - NAME_FUNC_OFFSET(16662, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), - NAME_FUNC_OFFSET(16681, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), - NAME_FUNC_OFFSET(16692, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), - NAME_FUNC_OFFSET(16704, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), - NAME_FUNC_OFFSET(16718, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), - NAME_FUNC_OFFSET(16731, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), - NAME_FUNC_OFFSET(16747, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), - NAME_FUNC_OFFSET(16758, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), - NAME_FUNC_OFFSET(16771, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), - NAME_FUNC_OFFSET(16790, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), - NAME_FUNC_OFFSET(16810, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), - NAME_FUNC_OFFSET(16823, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), - NAME_FUNC_OFFSET(16833, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), - NAME_FUNC_OFFSET(16849, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), - NAME_FUNC_OFFSET(16868, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), - NAME_FUNC_OFFSET(16886, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), - NAME_FUNC_OFFSET(16907, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), - NAME_FUNC_OFFSET(16922, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), - NAME_FUNC_OFFSET(16937, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), - NAME_FUNC_OFFSET(16951, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), - NAME_FUNC_OFFSET(16966, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), - NAME_FUNC_OFFSET(16978, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), - NAME_FUNC_OFFSET(16991, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), - NAME_FUNC_OFFSET(17003, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), - NAME_FUNC_OFFSET(17016, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), - NAME_FUNC_OFFSET(17028, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), - NAME_FUNC_OFFSET(17041, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), - NAME_FUNC_OFFSET(17053, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), - NAME_FUNC_OFFSET(17066, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), - NAME_FUNC_OFFSET(17078, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), - NAME_FUNC_OFFSET(17091, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), - NAME_FUNC_OFFSET(17103, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), - NAME_FUNC_OFFSET(17116, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), - NAME_FUNC_OFFSET(17128, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), - NAME_FUNC_OFFSET(17141, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), - NAME_FUNC_OFFSET(17153, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), - NAME_FUNC_OFFSET(17166, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), - NAME_FUNC_OFFSET(17185, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), - NAME_FUNC_OFFSET(17204, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), - NAME_FUNC_OFFSET(17223, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), - NAME_FUNC_OFFSET(17236, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), - NAME_FUNC_OFFSET(17254, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), - NAME_FUNC_OFFSET(17275, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), - NAME_FUNC_OFFSET(17293, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), - NAME_FUNC_OFFSET(17313, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17327, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17344, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET(17360, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET(17379, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17397, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17418, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17440, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17459, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17481, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17504, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET(17523, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET(17543, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET(17562, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET(17582, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET(17601, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET(17621, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET(17640, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET(17660, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET(17679, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET(17699, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET(17719, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET(17740, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(17760, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(17781, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(17801, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(17822, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(17846, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(17864, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(17884, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(17902, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(17914, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(17927, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(17939, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(17952, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(17972, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(17996, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18010, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18027, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18042, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18060, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18074, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18091, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18106, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18124, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18138, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18155, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18170, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18188, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18202, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18219, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18234, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18252, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18266, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18283, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18298, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18316, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18330, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18347, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18362, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18380, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18394, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18411, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18426, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18444, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18458, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18475, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18490, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18508, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(18525, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(18545, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(18562, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18588, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18617, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(18632, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(18650, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(18669, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(18693, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(13470, gl_dispatch_stub_768, gl_dispatch_stub_768, NULL, _gloffset_StencilFuncSeparateATI), + NAME_FUNC_OFFSET(13495, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_ProgramEnvParameters4fvEXT), + NAME_FUNC_OFFSET(13524, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_ProgramLocalParameters4fvEXT), + NAME_FUNC_OFFSET(13555, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_GetQueryObjecti64vEXT), + NAME_FUNC_OFFSET(13579, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_GetQueryObjectui64vEXT), + NAME_FUNC_OFFSET(13604, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), + NAME_FUNC_OFFSET(13622, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), + NAME_FUNC_OFFSET(13639, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), + NAME_FUNC_OFFSET(13655, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), + NAME_FUNC_OFFSET(13680, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), + NAME_FUNC_OFFSET(13700, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), + NAME_FUNC_OFFSET(13720, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), + NAME_FUNC_OFFSET(13743, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), + NAME_FUNC_OFFSET(13766, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), + NAME_FUNC_OFFSET(13786, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), + NAME_FUNC_OFFSET(13803, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), + NAME_FUNC_OFFSET(13820, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), + NAME_FUNC_OFFSET(13835, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), + NAME_FUNC_OFFSET(13859, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), + NAME_FUNC_OFFSET(13878, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), + NAME_FUNC_OFFSET(13897, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), + NAME_FUNC_OFFSET(13913, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), + NAME_FUNC_OFFSET(13932, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), + NAME_FUNC_OFFSET(13955, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(13971, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(13987, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), + NAME_FUNC_OFFSET(14014, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), + NAME_FUNC_OFFSET(14041, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), + NAME_FUNC_OFFSET(14061, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14080, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14099, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14129, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14159, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14189, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14219, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), + NAME_FUNC_OFFSET(14238, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), + NAME_FUNC_OFFSET(14261, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), + NAME_FUNC_OFFSET(14286, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), + NAME_FUNC_OFFSET(14311, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), + NAME_FUNC_OFFSET(14338, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), + NAME_FUNC_OFFSET(14366, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), + NAME_FUNC_OFFSET(14393, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), + NAME_FUNC_OFFSET(14421, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), + NAME_FUNC_OFFSET(14450, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), + NAME_FUNC_OFFSET(14479, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), + NAME_FUNC_OFFSET(14505, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), + NAME_FUNC_OFFSET(14536, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), + NAME_FUNC_OFFSET(14567, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), + NAME_FUNC_OFFSET(14591, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), + NAME_FUNC_OFFSET(14614, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), + NAME_FUNC_OFFSET(14632, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), + NAME_FUNC_OFFSET(14661, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), + NAME_FUNC_OFFSET(14690, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), + NAME_FUNC_OFFSET(14705, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), + NAME_FUNC_OFFSET(14731, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), + NAME_FUNC_OFFSET(14757, glHistogram, glHistogram, NULL, _gloffset_Histogram), + NAME_FUNC_OFFSET(14772, glMinmax, glMinmax, NULL, _gloffset_Minmax), + NAME_FUNC_OFFSET(14784, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), + NAME_FUNC_OFFSET(14804, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), + NAME_FUNC_OFFSET(14821, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), + NAME_FUNC_OFFSET(14837, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), + NAME_FUNC_OFFSET(14856, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), + NAME_FUNC_OFFSET(14879, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), + NAME_FUNC_OFFSET(14895, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), + NAME_FUNC_OFFSET(14917, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), + NAME_FUNC_OFFSET(14935, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), + NAME_FUNC_OFFSET(14954, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), + NAME_FUNC_OFFSET(14972, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), + NAME_FUNC_OFFSET(14991, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), + NAME_FUNC_OFFSET(15009, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), + NAME_FUNC_OFFSET(15028, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), + NAME_FUNC_OFFSET(15046, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), + NAME_FUNC_OFFSET(15065, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), + NAME_FUNC_OFFSET(15083, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), + NAME_FUNC_OFFSET(15102, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), + NAME_FUNC_OFFSET(15120, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), + NAME_FUNC_OFFSET(15139, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), + NAME_FUNC_OFFSET(15157, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), + NAME_FUNC_OFFSET(15176, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), + NAME_FUNC_OFFSET(15194, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), + NAME_FUNC_OFFSET(15213, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), + NAME_FUNC_OFFSET(15231, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), + NAME_FUNC_OFFSET(15250, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), + NAME_FUNC_OFFSET(15268, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), + NAME_FUNC_OFFSET(15287, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), + NAME_FUNC_OFFSET(15305, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), + NAME_FUNC_OFFSET(15324, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), + NAME_FUNC_OFFSET(15342, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), + NAME_FUNC_OFFSET(15361, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), + NAME_FUNC_OFFSET(15379, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), + NAME_FUNC_OFFSET(15398, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), + NAME_FUNC_OFFSET(15416, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), + NAME_FUNC_OFFSET(15435, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), + NAME_FUNC_OFFSET(15453, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), + NAME_FUNC_OFFSET(15472, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), + NAME_FUNC_OFFSET(15490, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), + NAME_FUNC_OFFSET(15509, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate), + NAME_FUNC_OFFSET(15532, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), + NAME_FUNC_OFFSET(15555, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), + NAME_FUNC_OFFSET(15578, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), + NAME_FUNC_OFFSET(15601, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), + NAME_FUNC_OFFSET(15624, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), + NAME_FUNC_OFFSET(15641, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), + NAME_FUNC_OFFSET(15664, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), + NAME_FUNC_OFFSET(15687, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), + NAME_FUNC_OFFSET(15710, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), + NAME_FUNC_OFFSET(15736, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), + NAME_FUNC_OFFSET(15762, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), + NAME_FUNC_OFFSET(15788, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), + NAME_FUNC_OFFSET(15812, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), + NAME_FUNC_OFFSET(15839, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), + NAME_FUNC_OFFSET(15865, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), + NAME_FUNC_OFFSET(15885, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), + NAME_FUNC_OFFSET(15905, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), + NAME_FUNC_OFFSET(15925, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), + NAME_FUNC_OFFSET(15942, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), + NAME_FUNC_OFFSET(15960, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), + NAME_FUNC_OFFSET(15977, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), + NAME_FUNC_OFFSET(15995, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), + NAME_FUNC_OFFSET(16012, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), + NAME_FUNC_OFFSET(16030, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), + NAME_FUNC_OFFSET(16047, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), + NAME_FUNC_OFFSET(16065, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), + NAME_FUNC_OFFSET(16082, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), + NAME_FUNC_OFFSET(16100, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), + NAME_FUNC_OFFSET(16117, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), + NAME_FUNC_OFFSET(16135, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), + NAME_FUNC_OFFSET(16152, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), + NAME_FUNC_OFFSET(16170, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), + NAME_FUNC_OFFSET(16187, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), + NAME_FUNC_OFFSET(16205, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), + NAME_FUNC_OFFSET(16222, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), + NAME_FUNC_OFFSET(16240, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), + NAME_FUNC_OFFSET(16259, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), + NAME_FUNC_OFFSET(16278, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), + NAME_FUNC_OFFSET(16297, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), + NAME_FUNC_OFFSET(16316, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), + NAME_FUNC_OFFSET(16336, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), + NAME_FUNC_OFFSET(16356, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), + NAME_FUNC_OFFSET(16376, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), + NAME_FUNC_OFFSET(16394, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), + NAME_FUNC_OFFSET(16411, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), + NAME_FUNC_OFFSET(16429, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), + NAME_FUNC_OFFSET(16446, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), + NAME_FUNC_OFFSET(16464, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), + NAME_FUNC_OFFSET(16482, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), + NAME_FUNC_OFFSET(16499, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), + NAME_FUNC_OFFSET(16517, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), + NAME_FUNC_OFFSET(16536, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), + NAME_FUNC_OFFSET(16555, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), + NAME_FUNC_OFFSET(16574, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), + NAME_FUNC_OFFSET(16596, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), + NAME_FUNC_OFFSET(16609, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), + NAME_FUNC_OFFSET(16622, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), + NAME_FUNC_OFFSET(16638, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), + NAME_FUNC_OFFSET(16654, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), + NAME_FUNC_OFFSET(16667, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), + NAME_FUNC_OFFSET(16690, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), + NAME_FUNC_OFFSET(16710, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), + NAME_FUNC_OFFSET(16729, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), + NAME_FUNC_OFFSET(16740, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), + NAME_FUNC_OFFSET(16752, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), + NAME_FUNC_OFFSET(16766, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), + NAME_FUNC_OFFSET(16779, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), + NAME_FUNC_OFFSET(16795, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), + NAME_FUNC_OFFSET(16806, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), + NAME_FUNC_OFFSET(16819, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), + NAME_FUNC_OFFSET(16838, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), + NAME_FUNC_OFFSET(16858, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), + NAME_FUNC_OFFSET(16871, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), + NAME_FUNC_OFFSET(16881, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), + NAME_FUNC_OFFSET(16897, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), + NAME_FUNC_OFFSET(16916, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), + NAME_FUNC_OFFSET(16934, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), + NAME_FUNC_OFFSET(16955, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), + NAME_FUNC_OFFSET(16970, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), + NAME_FUNC_OFFSET(16985, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), + NAME_FUNC_OFFSET(16999, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), + NAME_FUNC_OFFSET(17014, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), + NAME_FUNC_OFFSET(17026, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), + NAME_FUNC_OFFSET(17039, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), + NAME_FUNC_OFFSET(17051, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), + NAME_FUNC_OFFSET(17064, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), + NAME_FUNC_OFFSET(17076, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), + NAME_FUNC_OFFSET(17089, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), + NAME_FUNC_OFFSET(17101, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), + NAME_FUNC_OFFSET(17114, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), + NAME_FUNC_OFFSET(17126, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), + NAME_FUNC_OFFSET(17139, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), + NAME_FUNC_OFFSET(17151, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), + NAME_FUNC_OFFSET(17164, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), + NAME_FUNC_OFFSET(17176, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), + NAME_FUNC_OFFSET(17189, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), + NAME_FUNC_OFFSET(17201, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), + NAME_FUNC_OFFSET(17214, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), + NAME_FUNC_OFFSET(17233, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), + NAME_FUNC_OFFSET(17252, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), + NAME_FUNC_OFFSET(17271, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), + NAME_FUNC_OFFSET(17284, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), + NAME_FUNC_OFFSET(17302, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), + NAME_FUNC_OFFSET(17323, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), + NAME_FUNC_OFFSET(17341, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), + NAME_FUNC_OFFSET(17361, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17375, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17392, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET(17408, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET(17427, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17445, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17466, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17488, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17507, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17529, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17552, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET(17571, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(17591, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(17610, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(17630, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(17649, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(17669, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(17688, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(17708, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(17727, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(17747, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(17767, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(17788, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(17808, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(17829, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(17849, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(17870, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(17894, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(17912, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(17932, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(17950, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(17962, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(17975, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(17987, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(18000, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18020, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18044, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18058, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18075, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18090, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18108, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18122, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18139, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18154, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18172, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18186, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18203, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18218, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18236, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18250, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18267, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18282, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18300, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18314, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18331, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18346, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18364, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18378, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18395, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18410, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18428, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18442, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18459, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18474, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18492, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18506, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18523, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18538, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18556, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(18573, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(18593, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(18610, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18636, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18665, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(18680, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(18698, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(18717, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(18741, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; Modified: haiku/vendor/mesa/current/src/main/api_validate.c =================================================================== --- haiku/vendor/mesa/current/src/main/api_validate.c 2008-01-05 15:35:48 UTC (rev 23256) +++ haiku/vendor/mesa/current/src/main/api_validate.c 2008-01-05 15:49:17 UTC (rev 23257) @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.0.1 + * Version: 7.0.2 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -30,6 +30,55 @@ #include "state.h" +/** + * Find the max index in the given element/index buffer + */ +static GLuint +max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, + const void *indices, + struct gl_buffer_object *elementBuf) +{ + const GLubyte *map = NULL; + GLuint max = 0; + GLint i; + + if (elementBuf->Name) { + /* elements are in a user-defined buffer object. need to map it */ + map = ctx->Driver.MapBuffer(ctx, + GL_ELEMENT_ARRAY_BUFFER_ARB, + GL_READ_ONLY, + elementBuf); + /* Actual address is the sum of pointers */ + indices = (const GLvoid *) ADD_POINTERS(map, (const GLubyte *) indices); + } + + if (type == GL_UNSIGNED_INT) { [... truncated: 5068 lines follow ...] From korli at mail.berlios.de Sat Jan 5 16:51:17 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 5 Jan 2008 16:51:17 +0100 Subject: [Haiku-commits] r23258 - haiku/vendor/mesa Message-ID: <200801051551.m05FpHbr014728@sheep.berlios.de> Author: korli Date: 2008-01-05 16:51:17 +0100 (Sat, 05 Jan 2008) New Revision: 23258 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23258&view=rev Added: haiku/vendor/mesa/7.0.2/ Log: tagging Mesa 7.0.2 Copied: haiku/vendor/mesa/7.0.2 (from rev 23257, haiku/vendor/mesa/current) From korli at mail.berlios.de Sat Jan 5 17:10:39 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 5 Jan 2008 17:10:39 +0100 Subject: [Haiku-commits] r23259 - haiku/trunk/src/add-ons/kernel/busses/scsi/ahci Message-ID: <200801051610.m05GAd70015906@sheep.berlios.de> Author: korli Date: 2008-01-05 17:10:39 +0100 (Sat, 05 Jan 2008) New Revision: 23259 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23259&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp Log: fix gcc4 build Modified: haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 2008-01-05 15:51:17 UTC (rev 23258) +++ haiku/trunk/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 2008-01-05 16:10:39 UTC (rev 23259) @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -502,7 +503,7 @@ { TRACE("AHCIPort::ScsiSynchronizeCache port %d\n", fIndex); - sata_request *sreq = new sata_request(request); + sata_request *sreq = new(std::nothrow) sata_request(request); sreq->set_ata_cmd(fUse48BitCommands ? 0xea : 0xe7); // Flush Cache ExecuteSataRequest(sreq); } @@ -555,7 +556,7 @@ #endif ASSERT(request->data_length == sectorCount * 512); - sata_request *sreq = new sata_request(request); + sata_request *sreq = new(std::nothrow) sata_request(request); if (fUse48BitCommands) { if (sectorCount > 65536) From korli at mail.berlios.de Sat Jan 5 17:12:34 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 5 Jan 2008 17:12:34 +0100 Subject: [Haiku-commits] r23260 - in haiku/trunk: headers/os/opengl/GL src/kits/opengl/glu/libutil src/kits/opengl/mesa/glapi src/kits/opengl/mesa/main src/kits/opengl/mesa/shader src/kits/opengl/mesa/shader/slang/library src/kits/opengl/mesa/sparc src/kits/opengl/mesa/swrast src/kits/opengl/mesa/swrast_setup src/kits/opengl/mesa/tnl src/kits/opengl/mesa/vbo src/kits/opengl/mesa/x86 src/kits/opengl/mesa/x86/rtasm src/kits/opengl/mesa/x86-64 Message-ID: <200801051612.m05GCYeB015987@sheep.berlios.de> Author: korli Date: 2008-01-05 17:12:28 +0100 (Sat, 05 Jan 2008) New Revision: 23260 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23260&view=rev Removed: haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_builtin_120_common_gc.h haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_builtin_120_fragment_gc.h haiku/trunk/src/kits/opengl/mesa/x86-64/matypes.h Modified: haiku/trunk/headers/os/opengl/GL/glu.h haiku/trunk/src/kits/opengl/glu/libutil/project.c haiku/trunk/src/kits/opengl/mesa/glapi/dispatch.h haiku/trunk/src/kits/opengl/mesa/glapi/glapioffsets.h haiku/trunk/src/kits/opengl/mesa/glapi/glapitable.h haiku/trunk/src/kits/opengl/mesa/glapi/glapitemp.h haiku/trunk/src/kits/opengl/mesa/glapi/glprocs.h haiku/trunk/src/kits/opengl/mesa/main/api_validate.c haiku/trunk/src/kits/opengl/mesa/main/attrib.c haiku/trunk/src/kits/opengl/mesa/main/attrib.h haiku/trunk/src/kits/opengl/mesa/main/context.c haiku/trunk/src/kits/opengl/mesa/main/dlist.c haiku/trunk/src/kits/opengl/mesa/main/enable.c haiku/trunk/src/kits/opengl/mesa/main/enums.c haiku/trunk/src/kits/opengl/mesa/main/fbobject.c haiku/trunk/src/kits/opengl/mesa/main/framebuffer.c haiku/trunk/src/kits/opengl/mesa/main/glheader.h haiku/trunk/src/kits/opengl/mesa/main/image.c haiku/trunk/src/kits/opengl/mesa/main/light.c haiku/trunk/src/kits/opengl/mesa/main/lines.c haiku/trunk/src/kits/opengl/mesa/main/mtypes.h haiku/trunk/src/kits/opengl/mesa/main/points.c haiku/trunk/src/kits/opengl/mesa/main/polygon.c haiku/trunk/src/kits/opengl/mesa/main/state.c haiku/trunk/src/kits/opengl/mesa/main/stencil.c haiku/trunk/src/kits/opengl/mesa/main/stencil.h haiku/trunk/src/kits/opengl/mesa/main/texenvprogram.c haiku/trunk/src/kits/opengl/mesa/main/texobj.c haiku/trunk/src/kits/opengl/mesa/main/texobj.h haiku/trunk/src/kits/opengl/mesa/main/texstate.c haiku/trunk/src/kits/opengl/mesa/main/version.h haiku/trunk/src/kits/opengl/mesa/shader/arbprogparse.c haiku/trunk/src/kits/opengl/mesa/shader/atifragshader.c haiku/trunk/src/kits/opengl/mesa/shader/prog_statevars.c haiku/trunk/src/kits/opengl/mesa/shader/shader_api.c haiku/trunk/src/kits/opengl/mesa/sparc/glapi_sparc.S haiku/trunk/src/kits/opengl/mesa/swrast/s_copypix.c haiku/trunk/src/kits/opengl/mesa/swrast/s_pointtemp.h haiku/trunk/src/kits/opengl/mesa/swrast/s_span.c haiku/trunk/src/kits/opengl/mesa/swrast_setup/ss_tritmp.h haiku/trunk/src/kits/opengl/mesa/tnl/t_draw.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_fog.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vertex_sse.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vp_build.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_save_draw.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_split_copy.c haiku/trunk/src/kits/opengl/mesa/x86-64/glapi_x86-64.S haiku/trunk/src/kits/opengl/mesa/x86-64/xform4.S haiku/trunk/src/kits/opengl/mesa/x86/glapi_x86.S haiku/trunk/src/kits/opengl/mesa/x86/matypes.h haiku/trunk/src/kits/opengl/mesa/x86/read_rgba_span_x86.S haiku/trunk/src/kits/opengl/mesa/x86/rtasm/x86sse.c haiku/trunk/src/kits/opengl/mesa/x86/rtasm/x86sse.h Log: updated mesa to 7.0.2 Modified: haiku/trunk/headers/os/opengl/GL/glu.h =================================================================== --- haiku/trunk/headers/os/opengl/GL/glu.h 2008-01-05 16:10:39 UTC (rev 23259) +++ haiku/trunk/headers/os/opengl/GL/glu.h 2008-01-05 16:12:28 UTC (rev 23260) @@ -44,23 +44,18 @@ #define GLAPIENTRYP GLAPIENTRY * #endif -#ifdef GLAPI -#undef GLAPI -#endif +#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32) +# undef GLAPI +# define GLAPI __declspec(dllexport) +#elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) +/* tag specifying we're building for DLL runtime support */ +# undef GLAPI +# define GLAPI __declspec(dllimport) +#elif !defined(GLAPI) +/* for use with static link lib build of Win32 edition only */ +# define GLAPI extern +#endif /* _STATIC_MESA support */ -# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32) -# define GLAPI __declspec(dllexport) -# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ -# define GLAPI __declspec(dllimport) -# else /* for use with static link lib build of Win32 edition only */ -# define GLAPI extern -# endif /* _STATIC_MESA support */ - - -#ifndef GLAPI -#define GLAPI -#endif - #ifdef __cplusplus extern "C" { #endif Modified: haiku/trunk/src/kits/opengl/glu/libutil/project.c =================================================================== --- haiku/trunk/src/kits/opengl/glu/libutil/project.c 2008-01-05 16:10:39 UTC (rev 23259) +++ haiku/trunk/src/kits/opengl/glu/libutil/project.c 2008-01-05 16:12:28 UTC (rev 23260) @@ -168,74 +168,57 @@ } /* -** inverse = invert(src) -** New, faster implementation by Shan Hao Bo, April 2006. +** Invert 4x4 matrix. +** Contributed by David Moore (See Mesa bug #6748) */ -static int __gluInvertMatrixd(const GLdouble src[16], GLdouble inverse[16]) +static int __gluInvertMatrixd(const GLdouble m[16], GLdouble invOut[16]) { - int i, j, k; - double t; - GLdouble temp[4][4]; - - for (i=0; i<4; i++) { - for (j=0; j<4; j++) { - temp[i][j] = src[i*4+j]; - } - } - __gluMakeIdentityd(inverse); - - for (i = 0; i < 4; i++) { - if (temp[i][i] == 0.0f) { - /* - ** Look for non-zero element in column - */ - for (j = i + 1; j < 4; j++) { - if (temp[j][i] != 0.0f) { - break; - } - } - - if (j != 4) { - /* - ** Swap rows. - */ - for (k = 0; k < 4; k++) { - t = temp[i][k]; - temp[i][k] = temp[j][k]; - temp[j][k] = t; - - t = inverse[i*4+k]; - inverse[i*4+k] = inverse[j*4+k]; - inverse[j*4+k] = t; - } - } - else { - /* - ** No non-zero pivot. The matrix is singular, -which shouldn't - ** happen. This means the user gave us a bad -matrix. - */ - return GL_FALSE; - } - } - - t = 1.0f / temp[i][i]; - for (k = 0; k < 4; k++) { - temp[i][k] *= t; - inverse[i*4+k] *= t; - } - for (j = 0; j < 4; j++) { - if (j != i) { - t = temp[j][i]; - for (k = 0; k < 4; k++) { - temp[j][k] -= temp[i][k]*t; - inverse[j*4+k] -= inverse[i*4+k]*t; - } - } - } - } - return GL_TRUE; + double inv[16], det; + int i; + + inv[0] = m[5]*m[10]*m[15] - m[5]*m[11]*m[14] - m[9]*m[6]*m[15] + + m[9]*m[7]*m[14] + m[13]*m[6]*m[11] - m[13]*m[7]*m[10]; + inv[4] = -m[4]*m[10]*m[15] + m[4]*m[11]*m[14] + m[8]*m[6]*m[15] + - m[8]*m[7]*m[14] - m[12]*m[6]*m[11] + m[12]*m[7]*m[10]; + inv[8] = m[4]*m[9]*m[15] - m[4]*m[11]*m[13] - m[8]*m[5]*m[15] + + m[8]*m[7]*m[13] + m[12]*m[5]*m[11] - m[12]*m[7]*m[9]; + inv[12] = -m[4]*m[9]*m[14] + m[4]*m[10]*m[13] + m[8]*m[5]*m[14] + - m[8]*m[6]*m[13] - m[12]*m[5]*m[10] + m[12]*m[6]*m[9]; + inv[1] = -m[1]*m[10]*m[15] + m[1]*m[11]*m[14] + m[9]*m[2]*m[15] + - m[9]*m[3]*m[14] - m[13]*m[2]*m[11] + m[13]*m[3]*m[10]; + inv[5] = m[0]*m[10]*m[15] - m[0]*m[11]*m[14] - m[8]*m[2]*m[15] + + m[8]*m[3]*m[14] + m[12]*m[2]*m[11] - m[12]*m[3]*m[10]; + inv[9] = -m[0]*m[9]*m[15] + m[0]*m[11]*m[13] + m[8]*m[1]*m[15] + - m[8]*m[3]*m[13] - m[12]*m[1]*m[11] + m[12]*m[3]*m[9]; + inv[13] = m[0]*m[9]*m[14] - m[0]*m[10]*m[13] - m[8]*m[1]*m[14] + + m[8]*m[2]*m[13] + m[12]*m[1]*m[10] - m[12]*m[2]*m[9]; + inv[2] = m[1]*m[6]*m[15] - m[1]*m[7]*m[14] - m[5]*m[2]*m[15] + + m[5]*m[3]*m[14] + m[13]*m[2]*m[7] - m[13]*m[3]*m[6]; + inv[6] = -m[0]*m[6]*m[15] + m[0]*m[7]*m[14] + m[4]*m[2]*m[15] + - m[4]*m[3]*m[14] - m[12]*m[2]*m[7] + m[12]*m[3]*m[6]; + inv[10] = m[0]*m[5]*m[15] - m[0]*m[7]*m[13] - m[4]*m[1]*m[15] + + m[4]*m[3]*m[13] + m[12]*m[1]*m[7] - m[12]*m[3]*m[5]; + inv[14] = -m[0]*m[5]*m[14] + m[0]*m[6]*m[13] + m[4]*m[1]*m[14] + - m[4]*m[2]*m[13] - m[12]*m[1]*m[6] + m[12]*m[2]*m[5]; + inv[3] = -m[1]*m[6]*m[11] + m[1]*m[7]*m[10] + m[5]*m[2]*m[11] + - m[5]*m[3]*m[10] - m[9]*m[2]*m[7] + m[9]*m[3]*m[6]; + inv[7] = m[0]*m[6]*m[11] - m[0]*m[7]*m[10] - m[4]*m[2]*m[11] + + m[4]*m[3]*m[10] + m[8]*m[2]*m[7] - m[8]*m[3]*m[6]; + inv[11] = -m[0]*m[5]*m[11] + m[0]*m[7]*m[9] + m[4]*m[1]*m[11] + - m[4]*m[3]*m[9] - m[8]*m[1]*m[7] + m[8]*m[3]*m[5]; + inv[15] = m[0]*m[5]*m[10] - m[0]*m[6]*m[9] - m[4]*m[1]*m[10] + + m[4]*m[2]*m[9] + m[8]*m[1]*m[6] - m[8]*m[2]*m[5]; + + det = m[0]*inv[0] + m[1]*inv[4] + m[2]*inv[8] + m[3]*inv[12]; + if (det == 0) + return GL_FALSE; + + det = 1.0 / det; + + for (i = 0; i < 16; i++) + invOut[i] = inv[i] * det; + + return GL_TRUE; } static void __gluMultMatricesd(const GLdouble a[16], const GLdouble b[16], Modified: haiku/trunk/src/kits/opengl/mesa/glapi/dispatch.h =================================================================== --- haiku/trunk/src/kits/opengl/mesa/glapi/dispatch.h 2008-01-05 16:10:39 UTC (rev 23259) +++ haiku/trunk/src/kits/opengl/mesa/glapi/dispatch.h 2008-01-05 16:12:28 UTC (rev 23260) @@ -2362,6 +2362,9 @@ #define CALL_BlitFramebufferEXT(disp, parameters) (*((disp)->BlitFramebufferEXT)) parameters #define GET_BlitFramebufferEXT(disp) ((disp)->BlitFramebufferEXT) #define SET_BlitFramebufferEXT(disp, fn) ((disp)->BlitFramebufferEXT = fn) +#define CALL_StencilFuncSeparateATI(disp, parameters) (*((disp)->StencilFuncSeparateATI)) parameters +#define GET_StencilFuncSeparateATI(disp) ((disp)->StencilFuncSeparateATI) +#define SET_StencilFuncSeparateATI(disp, fn) ((disp)->StencilFuncSeparateATI = fn) #define CALL_ProgramEnvParameters4fvEXT(disp, parameters) (*((disp)->ProgramEnvParameters4fvEXT)) parameters #define GET_ProgramEnvParameters4fvEXT(disp) ((disp)->ProgramEnvParameters4fvEXT) #define SET_ProgramEnvParameters4fvEXT(disp, fn) ((disp)->ProgramEnvParameters4fvEXT = fn) @@ -2377,7 +2380,7 @@ #else -#define driDispatchRemapTable_size 364 +#define driDispatchRemapTable_size 365 extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define AttachShader_remap_index 0 @@ -2740,10 +2743,11 @@ #define IsRenderbufferEXT_remap_index 357 #define RenderbufferStorageEXT_remap_index 358 #define BlitFramebufferEXT_remap_index 359 -#define ProgramEnvParameters4fvEXT_remap_index 360 -#define ProgramLocalParameters4fvEXT_remap_index 361 -#define GetQueryObjecti64vEXT_remap_index 362 -#define GetQueryObjectui64vEXT_remap_index 363 +#define StencilFuncSeparateATI_remap_index 360 +#define ProgramEnvParameters4fvEXT_remap_index 361 +#define ProgramLocalParameters4fvEXT_remap_index 362 +#define GetQueryObjecti64vEXT_remap_index 363 +#define GetQueryObjectui64vEXT_remap_index 364 #define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters) #define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index]) @@ -3825,6 +3829,9 @@ #define CALL_BlitFramebufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum)), driDispatchRemapTable[BlitFramebufferEXT_remap_index], parameters) #define GET_BlitFramebufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BlitFramebufferEXT_remap_index]) #define SET_BlitFramebufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BlitFramebufferEXT_remap_index], fn) +#define CALL_StencilFuncSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparateATI_remap_index], parameters) +#define GET_StencilFuncSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index]) +#define SET_StencilFuncSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index], fn) #define CALL_ProgramEnvParameters4fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], parameters) #define GET_ProgramEnvParameters4fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index]) #define SET_ProgramEnvParameters4fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], fn) Modified: haiku/trunk/src/kits/opengl/mesa/glapi/glapioffsets.h =================================================================== --- haiku/trunk/src/kits/opengl/mesa/glapi/glapioffsets.h 2008-01-05 16:10:39 UTC (rev 23259) +++ haiku/trunk/src/kits/opengl/mesa/glapi/glapioffsets.h 2008-01-05 16:12:28 UTC (rev 23260) @@ -800,11 +800,12 @@ #define _gloffset_IsRenderbufferEXT 765 #define _gloffset_RenderbufferStorageEXT 766 #define _gloffset_BlitFramebufferEXT 767 -#define _gloffset_ProgramEnvParameters4fvEXT 768 -#define _gloffset_ProgramLocalParameters4fvEXT 769 -#define _gloffset_GetQueryObjecti64vEXT 770 -#define _gloffset_GetQueryObjectui64vEXT 771 -#define _gloffset_FIRST_DYNAMIC 772 +#define _gloffset_StencilFuncSeparateATI 768 +#define _gloffset_ProgramEnvParameters4fvEXT 769 +#define _gloffset_ProgramLocalParameters4fvEXT 770 +#define _gloffset_GetQueryObjecti64vEXT 771 +#define _gloffset_GetQueryObjectui64vEXT 772 +#define _gloffset_FIRST_DYNAMIC 773 #else @@ -1168,6 +1169,7 @@ #define _gloffset_IsRenderbufferEXT driDispatchRemapTable[IsRenderbufferEXT_remap_index] #define _gloffset_RenderbufferStorageEXT driDispatchRemapTable[RenderbufferStorageEXT_remap_index] #define _gloffset_BlitFramebufferEXT driDispatchRemapTable[BlitFramebufferEXT_remap_index] +#define _gloffset_StencilFuncSeparateATI driDispatchRemapTable[StencilFuncSeparateATI_remap_index] #define _gloffset_ProgramEnvParameters4fvEXT driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index] #define _gloffset_ProgramLocalParameters4fvEXT driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index] #define _gloffset_GetQueryObjecti64vEXT driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index] Modified: haiku/trunk/src/kits/opengl/mesa/glapi/glapitable.h =================================================================== --- haiku/trunk/src/kits/opengl/mesa/glapi/glapitable.h 2008-01-05 16:10:39 UTC (rev 23259) +++ haiku/trunk/src/kits/opengl/mesa/glapi/glapitable.h 2008-01-05 16:12:28 UTC (rev 23260) @@ -464,7 +464,7 @@ GLboolean (GLAPIENTRYP IsShader)(GLuint shader); /* 420 */ void (GLAPIENTRYP StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); /* 421 */ void (GLAPIENTRYP StencilMaskSeparate)(GLenum face, GLuint mask); /* 422 */ - void (GLAPIENTRYP StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); /* 423 */ + void (GLAPIENTRYP StencilOpSeparate)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); /* 423 */ void (GLAPIENTRYP UniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 424 */ void (GLAPIENTRYP UniformMatrix2x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 425 */ void (GLAPIENTRYP UniformMatrix3x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 426 */ @@ -809,10 +809,11 @@ GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 765 */ void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 766 */ void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 767 */ - void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 768 */ - void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 769 */ - void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 770 */ - void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 771 */ + void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 768 */ + void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 769 */ + void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 770 */ + void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 771 */ + void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 772 */ }; #endif /* !defined( _GLAPI_TABLE_H_ ) */ Modified: haiku/trunk/src/kits/opengl/mesa/glapi/glapitemp.h =================================================================== --- haiku/trunk/src/kits/opengl/mesa/glapi/glapitemp.h 2008-01-05 16:10:39 UTC (rev 23259) +++ haiku/trunk/src/kits/opengl/mesa/glapi/glapitemp.h 2008-01-05 16:12:28 UTC (rev 23260) @@ -2754,11 +2754,18 @@ DISPATCH(StencilMaskSeparate, (face, mask), (F, "glStencilMaskSeparate(0x%x, %d);\n", face, mask)); } -KEYWORD1 void KEYWORD2 NAME(StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +KEYWORD1 void KEYWORD2 NAME(StencilOpSeparate)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) { - DISPATCH(StencilOpSeparate, (face, fail, zfail, zpass), (F, "glStencilOpSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", face, fail, zfail, zpass)); + DISPATCH(StencilOpSeparate, (face, sfail, zfail, zpass), (F, "glStencilOpSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", face, sfail, zfail, zpass)); } +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_423)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_423)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) +{ + DISPATCH(StencilOpSeparate, (face, sfail, zfail, zpass), (F, "glStencilOpSeparateATI(0x%x, 0x%x, 0x%x, 0x%x);\n", face, sfail, zfail, zpass)); +} + KEYWORD1 void KEYWORD2 NAME(UniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { DISPATCH(UniformMatrix2x3fv, (location, count, transpose, value), (F, "glUniformMatrix2x3fv(%d, %d, %d, %p);\n", location, count, transpose, (const void *) value)); @@ -5441,30 +5448,37 @@ DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebufferEXT(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) { - DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); + DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask)); } KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { + DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); +} + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +{ DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLuint id, GLenum pname, GLint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLuint id, GLenum pname, GLint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLuint id, GLenum pname, GLint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLuint id, GLenum pname, GLint64EXT * params) { DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLuint id, GLenum pname, GLuint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLuint id, GLenum pname, GLuint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLuint id, GLenum pname, GLuint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLuint id, GLenum pname, GLuint64EXT * params) { DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } @@ -6255,6 +6269,7 @@ TABLE_ENTRY(_dispatch_stub_769), TABLE_ENTRY(_dispatch_stub_770), TABLE_ENTRY(_dispatch_stub_771), + TABLE_ENTRY(_dispatch_stub_772), /* A whole bunch of no-op functions. These might be called * when someone tries to call a dynamically-registered * extension function without a current rendering context. Modified: haiku/trunk/src/kits/opengl/mesa/glapi/glprocs.h =================================================================== --- haiku/trunk/src/kits/opengl/mesa/glapi/glprocs.h 2008-01-05 16:10:39 UTC (rev 23259) +++ haiku/trunk/src/kits/opengl/mesa/glapi/glprocs.h 2008-01-05 16:12:28 UTC (rev 23260) @@ -820,6 +820,7 @@ "glIsRenderbufferEXT\0" "glRenderbufferStorageEXT\0" "glBlitFramebufferEXT\0" + "glStencilFuncSeparateATI\0" "glProgramEnvParameters4fvEXT\0" "glProgramLocalParameters4fvEXT\0" "glGetQueryObjecti64vEXT\0" @@ -915,6 +916,7 @@ "glMultiTexCoord4iv\0" "glMultiTexCoord4s\0" "glMultiTexCoord4sv\0" + "glStencilOpSeparateATI\0" "glLoadTransposeMatrixd\0" "glLoadTransposeMatrixf\0" "glMultTransposeMatrixd\0" @@ -1147,6 +1149,7 @@ #define gl_dispatch_stub_769 mgl_dispatch_stub_769 #define gl_dispatch_stub_770 mgl_dispatch_stub_770 #define gl_dispatch_stub_771 mgl_dispatch_stub_771 +#define gl_dispatch_stub_772 mgl_dispatch_stub_772 #endif /* USE_MGL_NAMESPACE */ @@ -1197,6 +1200,7 @@ extern void gl_dispatch_stub_769(void); extern void gl_dispatch_stub_770(void); extern void gl_dispatch_stub_771(void); +extern void gl_dispatch_stub_772(void); #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */ static const glprocs_table_t static_functions[] = { @@ -1968,284 +1972,286 @@ NAME_FUNC_OFFSET(13404, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), NAME_FUNC_OFFSET(13424, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), NAME_FUNC_OFFSET(13449, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_BlitFramebufferEXT), - NAME_FUNC_OFFSET(13470, gl_dispatch_stub_768, gl_dispatch_stub_768, NULL, _gloffset_ProgramEnvParameters4fvEXT), - NAME_FUNC_OFFSET(13499, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_ProgramLocalParameters4fvEXT), - NAME_FUNC_OFFSET(13530, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_GetQueryObjecti64vEXT), - NAME_FUNC_OFFSET(13554, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_GetQueryObjectui64vEXT), - NAME_FUNC_OFFSET(13579, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), - NAME_FUNC_OFFSET(13597, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), - NAME_FUNC_OFFSET(13614, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), - NAME_FUNC_OFFSET(13630, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), - NAME_FUNC_OFFSET(13655, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), - NAME_FUNC_OFFSET(13675, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), - NAME_FUNC_OFFSET(13695, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), - NAME_FUNC_OFFSET(13718, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), - NAME_FUNC_OFFSET(13741, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), - NAME_FUNC_OFFSET(13761, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), - NAME_FUNC_OFFSET(13778, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), - NAME_FUNC_OFFSET(13795, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), - NAME_FUNC_OFFSET(13810, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), - NAME_FUNC_OFFSET(13834, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), - NAME_FUNC_OFFSET(13853, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), - NAME_FUNC_OFFSET(13872, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), - NAME_FUNC_OFFSET(13888, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), - NAME_FUNC_OFFSET(13907, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), - NAME_FUNC_OFFSET(13930, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(13946, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(13962, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), - NAME_FUNC_OFFSET(13989, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), - NAME_FUNC_OFFSET(14016, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), - NAME_FUNC_OFFSET(14036, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14055, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14074, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14104, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14134, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14164, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14194, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), - NAME_FUNC_OFFSET(14213, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), - NAME_FUNC_OFFSET(14236, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), - NAME_FUNC_OFFSET(14261, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), - NAME_FUNC_OFFSET(14286, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), - NAME_FUNC_OFFSET(14313, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), - NAME_FUNC_OFFSET(14341, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), - NAME_FUNC_OFFSET(14368, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), - NAME_FUNC_OFFSET(14396, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), - NAME_FUNC_OFFSET(14425, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), - NAME_FUNC_OFFSET(14454, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), - NAME_FUNC_OFFSET(14480, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), - NAME_FUNC_OFFSET(14511, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), - NAME_FUNC_OFFSET(14542, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), - NAME_FUNC_OFFSET(14566, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), - NAME_FUNC_OFFSET(14589, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), - NAME_FUNC_OFFSET(14607, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), - NAME_FUNC_OFFSET(14636, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), - NAME_FUNC_OFFSET(14665, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), - NAME_FUNC_OFFSET(14680, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), - NAME_FUNC_OFFSET(14706, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), - NAME_FUNC_OFFSET(14732, glHistogram, glHistogram, NULL, _gloffset_Histogram), - NAME_FUNC_OFFSET(14747, glMinmax, glMinmax, NULL, _gloffset_Minmax), - NAME_FUNC_OFFSET(14759, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), - NAME_FUNC_OFFSET(14779, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), - NAME_FUNC_OFFSET(14796, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), - NAME_FUNC_OFFSET(14812, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), - NAME_FUNC_OFFSET(14831, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), - NAME_FUNC_OFFSET(14854, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), - NAME_FUNC_OFFSET(14870, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), - NAME_FUNC_OFFSET(14892, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), - NAME_FUNC_OFFSET(14910, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), - NAME_FUNC_OFFSET(14929, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), - NAME_FUNC_OFFSET(14947, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), - NAME_FUNC_OFFSET(14966, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), - NAME_FUNC_OFFSET(14984, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), - NAME_FUNC_OFFSET(15003, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), - NAME_FUNC_OFFSET(15021, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), - NAME_FUNC_OFFSET(15040, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), - NAME_FUNC_OFFSET(15058, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), - NAME_FUNC_OFFSET(15077, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), - NAME_FUNC_OFFSET(15095, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), - NAME_FUNC_OFFSET(15114, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), - NAME_FUNC_OFFSET(15132, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), - NAME_FUNC_OFFSET(15151, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), - NAME_FUNC_OFFSET(15169, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), - NAME_FUNC_OFFSET(15188, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), - NAME_FUNC_OFFSET(15206, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), - NAME_FUNC_OFFSET(15225, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), - NAME_FUNC_OFFSET(15243, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), - NAME_FUNC_OFFSET(15262, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), - NAME_FUNC_OFFSET(15280, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), - NAME_FUNC_OFFSET(15299, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), - NAME_FUNC_OFFSET(15317, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), - NAME_FUNC_OFFSET(15336, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), - NAME_FUNC_OFFSET(15354, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), - NAME_FUNC_OFFSET(15373, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), - NAME_FUNC_OFFSET(15391, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), - NAME_FUNC_OFFSET(15410, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), - NAME_FUNC_OFFSET(15428, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), - NAME_FUNC_OFFSET(15447, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), - NAME_FUNC_OFFSET(15465, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), - NAME_FUNC_OFFSET(15484, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), - NAME_FUNC_OFFSET(15507, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), - NAME_FUNC_OFFSET(15530, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), - NAME_FUNC_OFFSET(15553, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), - NAME_FUNC_OFFSET(15576, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), - NAME_FUNC_OFFSET(15593, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), - NAME_FUNC_OFFSET(15616, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), - NAME_FUNC_OFFSET(15639, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), - NAME_FUNC_OFFSET(15662, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), - NAME_FUNC_OFFSET(15688, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), - NAME_FUNC_OFFSET(15714, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), - NAME_FUNC_OFFSET(15740, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), - NAME_FUNC_OFFSET(15764, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), - NAME_FUNC_OFFSET(15791, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), - NAME_FUNC_OFFSET(15817, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), - NAME_FUNC_OFFSET(15837, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), - NAME_FUNC_OFFSET(15857, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), - NAME_FUNC_OFFSET(15877, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), - NAME_FUNC_OFFSET(15894, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), - NAME_FUNC_OFFSET(15912, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), - NAME_FUNC_OFFSET(15929, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), - NAME_FUNC_OFFSET(15947, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), - NAME_FUNC_OFFSET(15964, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), - NAME_FUNC_OFFSET(15982, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), - NAME_FUNC_OFFSET(15999, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), - NAME_FUNC_OFFSET(16017, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), - NAME_FUNC_OFFSET(16034, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), - NAME_FUNC_OFFSET(16052, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), - NAME_FUNC_OFFSET(16069, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), - NAME_FUNC_OFFSET(16087, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), - NAME_FUNC_OFFSET(16104, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), - NAME_FUNC_OFFSET(16122, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), - NAME_FUNC_OFFSET(16139, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), - NAME_FUNC_OFFSET(16157, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), - NAME_FUNC_OFFSET(16174, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), - NAME_FUNC_OFFSET(16192, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), - NAME_FUNC_OFFSET(16211, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), - NAME_FUNC_OFFSET(16230, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), - NAME_FUNC_OFFSET(16249, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), - NAME_FUNC_OFFSET(16268, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), - NAME_FUNC_OFFSET(16288, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), - NAME_FUNC_OFFSET(16308, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), - NAME_FUNC_OFFSET(16328, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), - NAME_FUNC_OFFSET(16346, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), - NAME_FUNC_OFFSET(16363, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), - NAME_FUNC_OFFSET(16381, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), - NAME_FUNC_OFFSET(16398, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), - NAME_FUNC_OFFSET(16416, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), - NAME_FUNC_OFFSET(16434, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), - NAME_FUNC_OFFSET(16451, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), - NAME_FUNC_OFFSET(16469, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), - NAME_FUNC_OFFSET(16488, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), - NAME_FUNC_OFFSET(16507, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), - NAME_FUNC_OFFSET(16526, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), - NAME_FUNC_OFFSET(16548, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), - NAME_FUNC_OFFSET(16561, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), - NAME_FUNC_OFFSET(16574, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), - NAME_FUNC_OFFSET(16590, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), - NAME_FUNC_OFFSET(16606, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), - NAME_FUNC_OFFSET(16619, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), - NAME_FUNC_OFFSET(16642, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), - NAME_FUNC_OFFSET(16662, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), - NAME_FUNC_OFFSET(16681, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), - NAME_FUNC_OFFSET(16692, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), - NAME_FUNC_OFFSET(16704, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), - NAME_FUNC_OFFSET(16718, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), - NAME_FUNC_OFFSET(16731, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), - NAME_FUNC_OFFSET(16747, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), - NAME_FUNC_OFFSET(16758, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), - NAME_FUNC_OFFSET(16771, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), - NAME_FUNC_OFFSET(16790, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), - NAME_FUNC_OFFSET(16810, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), - NAME_FUNC_OFFSET(16823, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), - NAME_FUNC_OFFSET(16833, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), - NAME_FUNC_OFFSET(16849, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), - NAME_FUNC_OFFSET(16868, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), - NAME_FUNC_OFFSET(16886, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), - NAME_FUNC_OFFSET(16907, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), - NAME_FUNC_OFFSET(16922, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), - NAME_FUNC_OFFSET(16937, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), - NAME_FUNC_OFFSET(16951, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), - NAME_FUNC_OFFSET(16966, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), - NAME_FUNC_OFFSET(16978, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), - NAME_FUNC_OFFSET(16991, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), - NAME_FUNC_OFFSET(17003, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), - NAME_FUNC_OFFSET(17016, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), - NAME_FUNC_OFFSET(17028, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), - NAME_FUNC_OFFSET(17041, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), - NAME_FUNC_OFFSET(17053, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), - NAME_FUNC_OFFSET(17066, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), - NAME_FUNC_OFFSET(17078, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), - NAME_FUNC_OFFSET(17091, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), - NAME_FUNC_OFFSET(17103, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), - NAME_FUNC_OFFSET(17116, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), - NAME_FUNC_OFFSET(17128, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), - NAME_FUNC_OFFSET(17141, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), - NAME_FUNC_OFFSET(17153, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), - NAME_FUNC_OFFSET(17166, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), - NAME_FUNC_OFFSET(17185, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), - NAME_FUNC_OFFSET(17204, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), - NAME_FUNC_OFFSET(17223, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), - NAME_FUNC_OFFSET(17236, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), - NAME_FUNC_OFFSET(17254, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), - NAME_FUNC_OFFSET(17275, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), - NAME_FUNC_OFFSET(17293, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), - NAME_FUNC_OFFSET(17313, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17327, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17344, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET(17360, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET(17379, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17397, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17418, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17440, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17459, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17481, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17504, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET(17523, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET(17543, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET(17562, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET(17582, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET(17601, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET(17621, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET(17640, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET(17660, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET(17679, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET(17699, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET(17719, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET(17740, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(17760, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(17781, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(17801, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(17822, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(17846, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(17864, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(17884, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(17902, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(17914, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(17927, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(17939, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(17952, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(17972, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(17996, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18010, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18027, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18042, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18060, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18074, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18091, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18106, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18124, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18138, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18155, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18170, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18188, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18202, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18219, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18234, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18252, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18266, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18283, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18298, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18316, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18330, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18347, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18362, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18380, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18394, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18411, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18426, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18444, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18458, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18475, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18490, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18508, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(18525, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(18545, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(18562, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18588, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18617, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(18632, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(18650, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(18669, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(18693, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(13470, gl_dispatch_stub_768, gl_dispatch_stub_768, NULL, _gloffset_StencilFuncSeparateATI), + NAME_FUNC_OFFSET(13495, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_ProgramEnvParameters4fvEXT), + NAME_FUNC_OFFSET(13524, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_ProgramLocalParameters4fvEXT), + NAME_FUNC_OFFSET(13555, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_GetQueryObjecti64vEXT), + NAME_FUNC_OFFSET(13579, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_GetQueryObjectui64vEXT), + NAME_FUNC_OFFSET(13604, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), + NAME_FUNC_OFFSET(13622, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), + NAME_FUNC_OFFSET(13639, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), + NAME_FUNC_OFFSET(13655, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), + NAME_FUNC_OFFSET(13680, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), + NAME_FUNC_OFFSET(13700, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), + NAME_FUNC_OFFSET(13720, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), + NAME_FUNC_OFFSET(13743, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), + NAME_FUNC_OFFSET(13766, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), + NAME_FUNC_OFFSET(13786, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), + NAME_FUNC_OFFSET(13803, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), + NAME_FUNC_OFFSET(13820, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), + NAME_FUNC_OFFSET(13835, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), + NAME_FUNC_OFFSET(13859, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), + NAME_FUNC_OFFSET(13878, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), + NAME_FUNC_OFFSET(13897, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), + NAME_FUNC_OFFSET(13913, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), + NAME_FUNC_OFFSET(13932, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), + NAME_FUNC_OFFSET(13955, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(13971, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(13987, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), + NAME_FUNC_OFFSET(14014, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), + NAME_FUNC_OFFSET(14041, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), + NAME_FUNC_OFFSET(14061, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14080, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14099, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14129, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14159, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14189, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14219, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), + NAME_FUNC_OFFSET(14238, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), + NAME_FUNC_OFFSET(14261, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), + NAME_FUNC_OFFSET(14286, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), + NAME_FUNC_OFFSET(14311, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), + NAME_FUNC_OFFSET(14338, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), + NAME_FUNC_OFFSET(14366, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), + NAME_FUNC_OFFSET(14393, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), + NAME_FUNC_OFFSET(14421, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), + NAME_FUNC_OFFSET(14450, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), + NAME_FUNC_OFFSET(14479, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), + NAME_FUNC_OFFSET(14505, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), + NAME_FUNC_OFFSET(14536, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), + NAME_FUNC_OFFSET(14567, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), + NAME_FUNC_OFFSET(14591, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), + NAME_FUNC_OFFSET(14614, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), + NAME_FUNC_OFFSET(14632, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), + NAME_FUNC_OFFSET(14661, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), + NAME_FUNC_OFFSET(14690, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), + NAME_FUNC_OFFSET(14705, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), + NAME_FUNC_OFFSET(14731, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), + NAME_FUNC_OFFSET(14757, glHistogram, glHistogram, NULL, _gloffset_Histogram), + NAME_FUNC_OFFSET(14772, glMinmax, glMinmax, NULL, _gloffset_Minmax), + NAME_FUNC_OFFSET(14784, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), + NAME_FUNC_OFFSET(14804, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), + NAME_FUNC_OFFSET(14821, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), + NAME_FUNC_OFFSET(14837, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), + NAME_FUNC_OFFSET(14856, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), + NAME_FUNC_OFFSET(14879, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), + NAME_FUNC_OFFSET(14895, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), + NAME_FUNC_OFFSET(14917, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), + NAME_FUNC_OFFSET(14935, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), + NAME_FUNC_OFFSET(14954, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), + NAME_FUNC_OFFSET(14972, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), + NAME_FUNC_OFFSET(14991, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), + NAME_FUNC_OFFSET(15009, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), + NAME_FUNC_OFFSET(15028, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), + NAME_FUNC_OFFSET(15046, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), + NAME_FUNC_OFFSET(15065, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), + NAME_FUNC_OFFSET(15083, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), + NAME_FUNC_OFFSET(15102, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), + NAME_FUNC_OFFSET(15120, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), + NAME_FUNC_OFFSET(15139, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), + NAME_FUNC_OFFSET(15157, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), + NAME_FUNC_OFFSET(15176, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), + NAME_FUNC_OFFSET(15194, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), + NAME_FUNC_OFFSET(15213, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), + NAME_FUNC_OFFSET(15231, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), + NAME_FUNC_OFFSET(15250, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), + NAME_FUNC_OFFSET(15268, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), + NAME_FUNC_OFFSET(15287, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), + NAME_FUNC_OFFSET(15305, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), + NAME_FUNC_OFFSET(15324, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), + NAME_FUNC_OFFSET(15342, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), + NAME_FUNC_OFFSET(15361, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), + NAME_FUNC_OFFSET(15379, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), + NAME_FUNC_OFFSET(15398, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), + NAME_FUNC_OFFSET(15416, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), + NAME_FUNC_OFFSET(15435, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), + NAME_FUNC_OFFSET(15453, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), + NAME_FUNC_OFFSET(15472, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), + NAME_FUNC_OFFSET(15490, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), + NAME_FUNC_OFFSET(15509, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate), + NAME_FUNC_OFFSET(15532, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), + NAME_FUNC_OFFSET(15555, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), + NAME_FUNC_OFFSET(15578, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), + NAME_FUNC_OFFSET(15601, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), + NAME_FUNC_OFFSET(15624, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), + NAME_FUNC_OFFSET(15641, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), + NAME_FUNC_OFFSET(15664, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), + NAME_FUNC_OFFSET(15687, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), + NAME_FUNC_OFFSET(15710, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), + NAME_FUNC_OFFSET(15736, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), + NAME_FUNC_OFFSET(15762, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), + NAME_FUNC_OFFSET(15788, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), + NAME_FUNC_OFFSET(15812, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), + NAME_FUNC_OFFSET(15839, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), + NAME_FUNC_OFFSET(15865, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), + NAME_FUNC_OFFSET(15885, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), + NAME_FUNC_OFFSET(15905, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), + NAME_FUNC_OFFSET(15925, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), + NAME_FUNC_OFFSET(15942, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), + NAME_FUNC_OFFSET(15960, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), + NAME_FUNC_OFFSET(15977, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), + NAME_FUNC_OFFSET(15995, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), + NAME_FUNC_OFFSET(16012, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), + NAME_FUNC_OFFSET(16030, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), + NAME_FUNC_OFFSET(16047, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), + NAME_FUNC_OFFSET(16065, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), + NAME_FUNC_OFFSET(16082, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), + NAME_FUNC_OFFSET(16100, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), + NAME_FUNC_OFFSET(16117, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), + NAME_FUNC_OFFSET(16135, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), + NAME_FUNC_OFFSET(16152, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), + NAME_FUNC_OFFSET(16170, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), + NAME_FUNC_OFFSET(16187, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), + NAME_FUNC_OFFSET(16205, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), + NAME_FUNC_OFFSET(16222, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), + NAME_FUNC_OFFSET(16240, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), + NAME_FUNC_OFFSET(16259, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), + NAME_FUNC_OFFSET(16278, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), + NAME_FUNC_OFFSET(16297, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), + NAME_FUNC_OFFSET(16316, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), + NAME_FUNC_OFFSET(16336, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), + NAME_FUNC_OFFSET(16356, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), + NAME_FUNC_OFFSET(16376, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), + NAME_FUNC_OFFSET(16394, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), + NAME_FUNC_OFFSET(16411, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), + NAME_FUNC_OFFSET(16429, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), + NAME_FUNC_OFFSET(16446, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), + NAME_FUNC_OFFSET(16464, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), + NAME_FUNC_OFFSET(16482, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), + NAME_FUNC_OFFSET(16499, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), + NAME_FUNC_OFFSET(16517, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), + NAME_FUNC_OFFSET(16536, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), + NAME_FUNC_OFFSET(16555, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), + NAME_FUNC_OFFSET(16574, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), + NAME_FUNC_OFFSET(16596, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), + NAME_FUNC_OFFSET(16609, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), + NAME_FUNC_OFFSET(16622, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), + NAME_FUNC_OFFSET(16638, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), + NAME_FUNC_OFFSET(16654, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), + NAME_FUNC_OFFSET(16667, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), + NAME_FUNC_OFFSET(16690, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), + NAME_FUNC_OFFSET(16710, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), + NAME_FUNC_OFFSET(16729, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), + NAME_FUNC_OFFSET(16740, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), + NAME_FUNC_OFFSET(16752, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), + NAME_FUNC_OFFSET(16766, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), + NAME_FUNC_OFFSET(16779, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), + NAME_FUNC_OFFSET(16795, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), + NAME_FUNC_OFFSET(16806, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), + NAME_FUNC_OFFSET(16819, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), + NAME_FUNC_OFFSET(16838, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), + NAME_FUNC_OFFSET(16858, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), + NAME_FUNC_OFFSET(16871, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), + NAME_FUNC_OFFSET(16881, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), + NAME_FUNC_OFFSET(16897, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), + NAME_FUNC_OFFSET(16916, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), + NAME_FUNC_OFFSET(16934, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), + NAME_FUNC_OFFSET(16955, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), + NAME_FUNC_OFFSET(16970, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), + NAME_FUNC_OFFSET(16985, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), + NAME_FUNC_OFFSET(16999, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), + NAME_FUNC_OFFSET(17014, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), + NAME_FUNC_OFFSET(17026, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), + NAME_FUNC_OFFSET(17039, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), + NAME_FUNC_OFFSET(17051, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), + NAME_FUNC_OFFSET(17064, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), + NAME_FUNC_OFFSET(17076, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), + NAME_FUNC_OFFSET(17089, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), + NAME_FUNC_OFFSET(17101, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), + NAME_FUNC_OFFSET(17114, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), + NAME_FUNC_OFFSET(17126, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), + NAME_FUNC_OFFSET(17139, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), + NAME_FUNC_OFFSET(17151, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), + NAME_FUNC_OFFSET(17164, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), + NAME_FUNC_OFFSET(17176, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), + NAME_FUNC_OFFSET(17189, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), + NAME_FUNC_OFFSET(17201, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), + NAME_FUNC_OFFSET(17214, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), + NAME_FUNC_OFFSET(17233, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), + NAME_FUNC_OFFSET(17252, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), + NAME_FUNC_OFFSET(17271, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), + NAME_FUNC_OFFSET(17284, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), + NAME_FUNC_OFFSET(17302, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), + NAME_FUNC_OFFSET(17323, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), + NAME_FUNC_OFFSET(17341, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), + NAME_FUNC_OFFSET(17361, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17375, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17392, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET(17408, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET(17427, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17445, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17466, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17488, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17507, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17529, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17552, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET(17571, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(17591, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(17610, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(17630, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(17649, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(17669, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(17688, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(17708, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(17727, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(17747, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(17767, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(17788, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(17808, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(17829, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(17849, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(17870, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(17894, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(17912, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(17932, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(17950, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(17962, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(17975, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(17987, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(18000, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18020, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18044, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18058, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18075, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18090, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18108, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18122, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18139, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18154, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18172, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18186, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18203, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18218, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18236, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18250, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18267, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18282, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18300, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18314, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18331, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18346, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18364, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18378, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18395, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18410, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18428, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18442, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18459, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18474, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18492, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18506, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18523, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18538, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18556, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(18573, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(18593, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(18610, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18636, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18665, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(18680, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(18698, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(18717, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(18741, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; Modified: haiku/trunk/src/kits/opengl/mesa/main/api_validate.c =================================================================== --- haiku/trunk/src/kits/opengl/mesa/main/api_validate.c 2008-01-05 16:10:39 UTC (rev 23259) +++ haiku/trunk/src/kits/opengl/mesa/main/api_validate.c 2008-01-05 16:12:28 UTC (rev 23260) @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.0.1 + * Version: 7.0.2 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -30,6 +30,55 @@ #include "state.h" +/** + * Find the max index in the given element/index buffer + */ +static GLuint +max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, + const void *indices, + struct gl_buffer_object *elementBuf) +{ + const GLubyte *map = NULL; + GLuint max = 0; + GLint i; + + if (elementBuf->Name) { + /* elements are in a user-defined buffer object. need to map it */ + map = ctx->Driver.MapBuffer(ctx, + GL_ELEMENT_ARRAY_BUFFER_ARB, + GL_READ_ONLY, + elementBuf); + /* Actual address is the sum of pointers */ + indices = (const GLvoid *) ADD_POINTERS(map, (const GLubyte *) indices); + } + + if (type == GL_UNSIGNED_INT) { [... truncated: 5068 lines follow ...] From axeld at pinc-software.de Sat Jan 5 17:28:34 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Sat, 05 Jan 2008 17:28:34 +0100 CET Subject: [Haiku-commits] =?iso-8859-15?q?r23259_-_haiku/trunk/src/add-ons/?= =?iso-8859-15?q?kernel/busses/scsi/ahci?= In-Reply-To: <200801051610.m05GAd70015906@sheep.berlios.de> Message-ID: <8601088109-BeMail@zon> korli at BerliOS wrote: > + sata_request *sreq = new(std::nothrow) sata_request(request); > sreq->set_ata_cmd(fUse48BitCommands ? 0xea : 0xe7); // Flush Cache And as always, always check if your allocation succeeded. Bye, Axel. From stippi at mail.berlios.de Sat Jan 5 17:46:54 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 5 Jan 2008 17:46:54 +0100 Subject: [Haiku-commits] r23261 - haiku/trunk/src/servers/app Message-ID: <200801051646.m05Gks7g017284@sheep.berlios.de> Author: stippi Date: 2008-01-05 17:46:53 +0100 (Sat, 05 Jan 2008) New Revision: 23261 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23261&view=rev Modified: haiku/trunk/src/servers/app/FontEngine.cpp Log: applied patch by Anthony Lee: * fixed rendering of certain chinese fonts (I think it fixes rendering of bitmap fonts in general, but it should not support rotated text AFAIKT, since that is only supported for vector fonts) Nice work, Anthony, thanks! Modified: haiku/trunk/src/servers/app/FontEngine.cpp =================================================================== --- haiku/trunk/src/servers/app/FontEngine.cpp 2008-01-05 16:12:28 UTC (rev 23260) +++ haiku/trunk/src/servers/app/FontEngine.cpp 2008-01-05 16:46:53 UTC (rev 23261) @@ -5,6 +5,7 @@ * Authors: * Maxim Shemanarev * Stephan A?mus + * Anthony Lee */ //---------------------------------------------------------------------------- @@ -421,59 +422,56 @@ switch(fGlyphRendering) { case glyph_ren_native_mono: - fLastError = FT_Render_Glyph(fFace->glyph, FT_RENDER_MODE_MONO); - if (fLastError == 0) { - decompose_ft_bitmap_mono(fFace->glyph->bitmap, - fFace->glyph->bitmap_left, - kFlipY ? -fFace->glyph->bitmap_top : - fFace->glyph->bitmap_top, - kFlipY, - fScanlineBin, - fScanlineStorageBin); - fBounds.x1 = fScanlineStorageBin.min_x(); - fBounds.y1 = fScanlineStorageBin.min_y(); - fBounds.x2 = fScanlineStorageBin.max_x(); - fBounds.y2 = fScanlineStorageBin.max_y(); - fDataSize = fScanlineStorageBin.byte_size(); - fDataType = glyph_data_mono; - return true; - } - break; - - case glyph_ren_native_gray8: - fLastError = FT_Render_Glyph(fFace->glyph, FT_RENDER_MODE_NORMAL); + fLastError = FT_Render_Glyph(fFace->glyph, + fGlyphRendering == glyph_ren_native_mono ? + FT_RENDER_MODE_MONO : FT_RENDER_MODE_NORMAL); if (fLastError == 0) { - decompose_ft_bitmap_gray8(fFace->glyph->bitmap, - fFace->glyph->bitmap_left, - kFlipY ? -fFace->glyph->bitmap_top : - fFace->glyph->bitmap_top, - kFlipY, - fScanlineAA, - fScanlineStorageAA); - fBounds.x1 = fScanlineStorageAA.min_x(); - fBounds.y1 = fScanlineStorageAA.min_y(); - fBounds.x2 = fScanlineStorageAA.max_x(); - fBounds.y2 = fScanlineStorageAA.max_y(); - fDataSize = fScanlineStorageAA.byte_size(); - fDataType = glyph_data_gray8; - return true; + switch (fFace->glyph->bitmap.pixel_mode) { + case FT_PIXEL_MODE_MONO: + decompose_ft_bitmap_mono(fFace->glyph->bitmap, + fFace->glyph->bitmap_left, + kFlipY ? -fFace->glyph->bitmap_top + : fFace->glyph->bitmap_top, + kFlipY, fScanlineBin, fScanlineStorageBin); + fBounds.x1 = fScanlineStorageBin.min_x(); + fBounds.y1 = fScanlineStorageBin.min_y(); + fBounds.x2 = fScanlineStorageBin.max_x(); + fBounds.y2 = fScanlineStorageBin.max_y(); + fDataSize = fScanlineStorageBin.byte_size(); + fDataType = glyph_data_mono; + return true; + + case FT_PIXEL_MODE_GRAY: + decompose_ft_bitmap_gray8(fFace->glyph->bitmap, + fFace->glyph->bitmap_left, + kFlipY ? -fFace->glyph->bitmap_top + : fFace->glyph->bitmap_top, + kFlipY, fScanlineAA, fScanlineStorageAA); + fBounds.x1 = fScanlineStorageAA.min_x(); + fBounds.y1 = fScanlineStorageAA.min_y(); + fBounds.x2 = fScanlineStorageAA.max_x(); + fBounds.y2 = fScanlineStorageAA.max_y(); + fDataSize = fScanlineStorageAA.byte_size(); + fDataType = glyph_data_gray8; + return true; + + default: + break; + } } break; - - + case glyph_ren_outline: fPath.remove_all(); - if (decompose_ft_outline(fFace->glyph->outline, kFlipY, - fPath)) { - - agg::rect_d bnd = fPath.bounding_rect(); + if (decompose_ft_outline(fFace->glyph->outline, kFlipY, fPath)) { + agg::rect_d bounds = fPath.bounding_rect(); + fBounds.x1 = int(floor(bounds.x1)); + fBounds.y1 = int(floor(bounds.y1)); + fBounds.x2 = int(ceil(bounds.x2)); + fBounds.y2 = int(ceil(bounds.y2)); fDataSize = fPath.byte_size(); fDataType = glyph_data_outline; - fBounds.x1 = int(floor(bnd.x1)); - fBounds.y1 = int(floor(bnd.y1)); - fBounds.x2 = int(ceil(bnd.x2)); - fBounds.y2 = int(ceil(bnd.y2)); return true; } break; @@ -580,11 +578,15 @@ } FT_Set_Pixel_Sizes(fFace, - unsigned(size * 64.0) >> 6, // pixel_width - unsigned(size * 64.0) >> 6); // pixel_height + unsigned(size * 64.0) >> 6, // pixel_width + unsigned(size * 64.0) >> 6); // pixel_height - if (charMap != FT_ENCODING_NONE) + if (charMap != FT_ENCODING_NONE) { fLastError = FT_Select_Charmap(fFace, charMap); + } else { + if (FT_Select_Charmap(fFace, FT_ENCODING_UNICODE) != 0) + fLastError = FT_Select_Charmap(fFace, FT_ENCODING_NONE); + } return fLastError == 0; } From axeld at pinc-software.de Sat Jan 5 18:53:46 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Sat, 05 Jan 2008 18:53:46 +0100 CET Subject: [Haiku-commits] r23261 - haiku/trunk/src/servers/app In-Reply-To: <200801051646.m05Gks7g017284@sheep.berlios.de> Message-ID: <13713369568-BeMail@zon> stippi at BerliOS wrote: > Log: > applied patch by Anthony Lee: > * fixed rendering of certain chinese fonts I thought the patch that's part of bug #1685 (http://dev.haiku-os.org/ticket/1685) would fix that problem, too? Bye, Axel. From superstippi at gmx.de Sat Jan 5 19:40:57 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 05 Jan 2008 19:40:57 +0100 Subject: [Haiku-commits] r23261 - haiku/trunk/src/servers/app In-Reply-To: <13713369568-BeMail@zon> References: <13713369568-BeMail@zon> Message-ID: <20080105194057.4300.1@stippis2.1199551122.fake> Axel D?rfler wrote (2008-01-05, 18:53:46 [+0100]): > stippi at BerliOS wrote: > > Log: > > applied patch by Anthony Lee: > > * fixed rendering of certain chinese fonts > > I thought the patch that's part of bug #1685 > (http://dev.haiku-os.org/ticket/1685) would fix that problem, too? I will check, I am not on top of things... Thanks and best regards, -Stephan From mmu_man at mail.berlios.de Sat Jan 5 22:56:24 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 5 Jan 2008 22:56:24 +0100 Subject: [Haiku-commits] r23262 - haiku/trunk/data/artwork/icons Message-ID: <200801052156.m05LuO01019358@sheep.berlios.de> Author: mmu_man Date: 2008-01-05 22:56:23 +0100 (Sat, 05 Jan 2008) New Revision: 23262 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23262&view=rev Added: haiku/trunk/data/artwork/icons/File_GoogleFS haiku/trunk/data/artwork/icons/Overlay_google Log: A Google eyes overlay and an icon for googlefs... the gradient isn't what I wanted but it's enough. Added: haiku/trunk/data/artwork/icons/File_GoogleFS =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/artwork/icons/File_GoogleFS ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/data/artwork/icons/Overlay_google =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/artwork/icons/Overlay_google ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From revol at free.fr Sun Jan 6 00:18:28 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sun, 06 Jan 2008 00:18:28 +0100 CET Subject: [Haiku-commits] r23261 - haiku/trunk/src/servers/app In-Reply-To: <200801051646.m05Gks7g017284@sheep.berlios.de> Message-ID: <288062472-BeMail@laptop> > > (I think it fixes rendering of bitmap fonts in general, but it should > not > support rotated text AFAIKT, since that is only supported for vector > fonts) Hmm talking about bitmap fonts, I saw FreeType supports them, which format can we use ? Is it easy to add a loader for a freetype supported format ? (windoze .FON or unix ones ?) Fran?ois. From mmu_man at mail.berlios.de Sun Jan 6 01:40:17 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 6 Jan 2008 01:40:17 +0100 Subject: [Haiku-commits] r23263 - haiku/trunk/headers/private/kernel/boot/platform/atari_m68k Message-ID: <200801060040.m060eH62013842@sheep.berlios.de> Author: mmu_man Date: 2008-01-06 01:40:17 +0100 (Sun, 06 Jan 2008) New Revision: 23263 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23263&view=rev Modified: haiku/trunk/headers/private/kernel/boot/platform/atari_m68k/platform_stage2_args.h Log: Avoid empty struct Modified: haiku/trunk/headers/private/kernel/boot/platform/atari_m68k/platform_stage2_args.h =================================================================== --- haiku/trunk/headers/private/kernel/boot/platform/atari_m68k/platform_stage2_args.h 2008-01-05 21:56:23 UTC (rev 23262) +++ haiku/trunk/headers/private/kernel/boot/platform/atari_m68k/platform_stage2_args.h 2008-01-06 00:40:17 UTC (rev 23263) @@ -10,6 +10,7 @@ #endif struct platform_stage2_args { + int dummy; }; #endif /* KERNEL_BOOT_PLATFORM_ATARI_M68K_STAGE2_ARGS_H */ From stefano.ceccherini at gmail.com Sun Jan 6 11:04:56 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Sun, 6 Jan 2008 11:04:56 +0100 Subject: [Haiku-commits] r23154 - in haiku/trunk: headers/os/interface src/kits/interface src/servers/app In-Reply-To: <619508294-BeMail@laptop> References: <894b9700712261337q4f56f6aavd831e157e0542a82@mail.gmail.com> <619508294-BeMail@laptop> Message-ID: <894b9700801060204r757ab193i725a9c82353587ba@mail.gmail.com> 2007/12/27, Fran?ois Revol : > > 2007/12/26, Fran?ois Revol : > > > > With these changes, support for B_DRAW_ON_CHILDREN and > > > > the DrawAfterChildren() > > > > hook are implemented and behave exactly as on R5 as far as I can > > > > tell, also > > > > for the view background painting. > > > > > > Oh, that will certainly help BSnow, thx ;) > > > > > > > Is it supposed to cover the desktop only partially or it's a bug of > > BShelf ? > > It's certainly a bug somewhere. Should be fixed now. At least, I can see the BDragger in the right bottom corner, and the snow starts from the top left corner of the desktop. Although, the snow falls somewhat in a strange way. Can you check if it looks like it should ? From axeld at mail.berlios.de Sun Jan 6 14:21:01 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 6 Jan 2008 14:21:01 +0100 Subject: [Haiku-commits] r23264 - haiku/trunk/src/tools/fs_shell Message-ID: <200801061321.m06DL11R027606@sheep.berlios.de> Author: axeld Date: 2008-01-06 14:21:00 +0100 (Sun, 06 Jan 2008) New Revision: 23264 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23264&view=rev Modified: haiku/trunk/src/tools/fs_shell/file_cache.cpp haiku/trunk/src/tools/fs_shell/file_map.cpp Log: * The file_map constructor would not set the size of the file_map object, causing all reads with an offset unequal to 0 to fail. * Also fixed file_map_translate() which was hiding this problem. * Fixed build and warnings when compiled with debugging output. Modified: haiku/trunk/src/tools/fs_shell/file_cache.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/file_cache.cpp 2008-01-06 00:40:17 UTC (rev 23263) +++ haiku/trunk/src/tools/fs_shell/file_cache.cpp 2008-01-06 13:21:00 UTC (rev 23264) @@ -151,7 +151,7 @@ file_cache_ref *ref = (file_cache_ref *)_cacheRef; fssh_off_t fileSize = ref->virtual_size; - TRACE(("cache_io(ref = %p, offset = %Ld, buffer = %p, size = %lu, %s)\n", + TRACE(("cache_io(ref = %p, offset = %Ld, buffer = %p, size = %u, %s)\n", ref, offset, (void *)buffer, *_size, doWrite ? "write" : "read")); // out of bounds access? @@ -235,7 +235,8 @@ fssh_file_cache_create(fssh_mount_id mountID, fssh_vnode_id vnodeID, fssh_off_t size) { - TRACE(("file_cache_create(mountID = %ld, vnodeID = %Ld, size = %Ld, fd = %d)\n", mountID, vnodeID, size, fd)); + TRACE(("file_cache_create(mountID = %d, vnodeID = %Ld, size = %Ld)\n", + mountID, vnodeID, size)); file_cache_ref *ref = new(nothrow) file_cache_ref; if (ref == NULL) @@ -321,7 +322,7 @@ { file_cache_ref *ref = (file_cache_ref *)_cacheRef; - TRACE(("file_cache_read(ref = %p, offset = %Ld, buffer = %p, size = %lu)\n", + TRACE(("file_cache_read(ref = %p, offset = %Ld, buffer = %p, size = %u)\n", ref, offset, bufferBase, *_size)); return cache_io(ref, cookie, offset, (fssh_addr_t)bufferBase, _size, false); @@ -336,7 +337,7 @@ fssh_status_t status = cache_io(ref, cookie, offset, (fssh_addr_t)const_cast(buffer), _size, true); - TRACE(("file_cache_write(ref = %p, offset = %Ld, buffer = %p, size = %lu) = %ld\n", + TRACE(("file_cache_write(ref = %p, offset = %Ld, buffer = %p, size = %u) = %d\n", ref, offset, buffer, *_size, status)); return status; Modified: haiku/trunk/src/tools/fs_shell/file_map.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/file_map.cpp 2008-01-06 00:40:17 UTC (rev 23263) +++ haiku/trunk/src/tools/fs_shell/file_map.cpp 2008-01-06 13:21:00 UTC (rev 23264) @@ -57,7 +57,7 @@ { array = NULL; count = 0; - size = size; + size = _size; } @@ -91,7 +91,7 @@ file_map::Add(fssh_file_io_vec *vecs, fssh_size_t vecCount, fssh_off_t &lastOffset) { - TRACE(("file_map::Add(vecCount = %ld)\n", vecCount)); + TRACE(("file_map::Add(vecCount = %u)\n", vecCount)); fssh_off_t offset = 0; @@ -129,7 +129,7 @@ #ifdef TRACE_FILE_MAP for (uint32_t i = 0; i < count; i++) { file_extent *extent = ExtentAt(i); - fssh_dprintf("[%ld] extend offset %Ld, disk offset %Ld, length %Ld\n", + fssh_dprintf("[%u] extend offset %Ld, disk offset %Ld, length %Ld\n", i, extent->offset, extent->disk.offset, extent->disk.length); } #endif @@ -183,7 +183,7 @@ fssh_file_map_create(fssh_mount_id mountID, fssh_vnode_id vnodeID, fssh_off_t size) { - TRACE(("file_map_create(mountID = %ld, vnodeID = %Ld)\n", mountID, vnodeID)); + TRACE(("file_map_create(mountID = %d, vnodeID = %Ld)\n", mountID, vnodeID)); file_map *map = new file_map(size); if (map == NULL) @@ -249,7 +249,7 @@ fssh_size_t maxVecs = *_count; fssh_status_t status = FSSH_B_OK; - if (offset > map.size) { + if (offset >= map.size) { *_count = 0; return FSSH_B_OK; } From axeld at mail.berlios.de Sun Jan 6 15:04:16 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 6 Jan 2008 15:04:16 +0100 Subject: [Haiku-commits] r23265 - in haiku/trunk/src: system/kernel/cache system/kernel/fs tools/fs_shell Message-ID: <200801061404.m06E4GCn029777@sheep.berlios.de> Author: axeld Date: 2008-01-06 15:04:15 +0100 (Sun, 06 Jan 2008) New Revision: 23265 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23265&view=rev Modified: haiku/trunk/src/system/kernel/cache/file_map.cpp haiku/trunk/src/system/kernel/fs/vfs.cpp haiku/trunk/src/tools/fs_shell/vfs.cpp Log: * Fixed a big bug in common_file_io_vec_pages(): vecOffset was not correctly set when the first chunk of the file could be read in directly, causing it to read data to a wrong place in the buffer. * Reading in the first chunk directly would have also only worked if vecIndex and vecOffset was 0 when calling the function. * Applied the fs_shell changes in file_map to the kernel version as well (the constructor already worked correctly, though). Modified: haiku/trunk/src/system/kernel/cache/file_map.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/file_map.cpp 2008-01-06 13:21:00 UTC (rev 23264) +++ haiku/trunk/src/system/kernel/cache/file_map.cpp 2008-01-06 14:04:15 UTC (rev 23265) @@ -253,7 +253,7 @@ size_t maxVecs = *_count; status_t status = B_OK; - if (offset > map.size) { + if (offset >= map.size) { *_count = 0; return B_OK; } Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-01-06 13:21:00 UTC (rev 23264) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-01-06 14:04:15 UTC (rev 23265) @@ -2594,7 +2594,7 @@ status_t status; size_t size; - if (!doWrite) { + if (!doWrite && vecOffset == 0) { // now directly read the data from the device // the first file_io_vec can be read directly @@ -2603,8 +2603,8 @@ size = numBytes; status = FS_CALL(vnode, read_pages)(vnode->mount->cookie, - vnode->private_node, cookie, fileVecs[0].offset, vecs, vecCount, - &size, false); + vnode->private_node, cookie, fileVecs[0].offset, &vecs[vecIndex], + vecCount - vecIndex, &size, false); if (status < B_OK) return status; @@ -2636,9 +2636,11 @@ for (; vecIndex < vecCount; vecIndex++) { if (size < vecs[vecIndex].iov_len) break; - + size -= vecs[vecIndex].iov_len; } + + vecOffset = size; } else { fileVecIndex = 0; size = 0; Modified: haiku/trunk/src/tools/fs_shell/vfs.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/vfs.cpp 2008-01-06 13:21:00 UTC (rev 23264) +++ haiku/trunk/src/tools/fs_shell/vfs.cpp 2008-01-06 14:04:15 UTC (rev 23265) @@ -1749,7 +1749,7 @@ fssh_status_t status; fssh_size_t size; - if (!doWrite) { + if (!doWrite && vecOffset == 0) { // now directly read the data from the device // the first file_io_vec can be read directly @@ -1757,8 +1757,8 @@ if (size > numBytes) size = numBytes; - status = fssh_read_pages(fd, fileVecs[0].offset, vecs, vecCount, - &size, false); + status = fssh_read_pages(fd, fileVecs[0].offset, &vecs[vecIndex], + vecCount - vecIndex, &size, false); if (status < FSSH_B_OK) return status; @@ -1790,9 +1790,11 @@ for (; vecIndex < vecCount; vecIndex++) { if (size < vecs[vecIndex].iov_len) break; - + size -= vecs[vecIndex].iov_len; } + + vecOffset = size; } else { fileVecIndex = 0; size = 0; From sbenedetto at mail.berlios.de Sun Jan 6 15:34:23 2008 From: sbenedetto at mail.berlios.de (sbenedetto at BerliOS) Date: Sun, 6 Jan 2008 15:34:23 +0100 Subject: [Haiku-commits] r23266 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200801061434.m06EYNsK031114@sheep.berlios.de> Author: sbenedetto Date: 2008-01-06 15:34:22 +0100 (Sun, 06 Jan 2008) New Revision: 23266 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23266&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/ohci.h haiku/trunk/src/add-ons/kernel/busses/usb/ohci_hardware.h Log: * Started working on the finisher thread * Added some TRACE calls in the _InterruptHandler Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-01-06 14:04:15 UTC (rev 23265) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-01-06 14:34:22 UTC (rev 23266) @@ -378,23 +378,31 @@ if (status & OHCI_SCHEDULING_OVERRUN) { // TODO + TRACE(("usb_ohci: scheduling overrun occured\n")); } if (status & OHCI_WRITEBACK_DONE_HEAD) { - // TODO + TRACE(("usb_ohci: transfer descriptor processed\n")); + // Ack it in the finisher thread, not here. + result = B_INVOKE_SCHEDULER; finishTransfers = true; } if (status & OHCI_RESUME_DETECTED) { // TODO + TRACE(("usb_ohci: resume detected\n")); } if (status & OHCI_UNRECOVERABLE_ERROR) { - // TODO + TRACE(("usb_ohci: unrecoverable error. Controller halted\n")); + _WriteReg(OHCI_CONTROL, OHCI_HC_FUNCTIONAL_STATE_RESET); + // TODO: what else? + // Perhaps, clean up all the memory. } if (status & OHCI_ROOT_HUB_STATUS_CHANGE) { // TODO + TRACE(("usb_ohci: root hub status change\n")); } release_spinlock(&lock); @@ -420,13 +428,51 @@ while (!fStopFinishThread) { if (acquire_sem(fFinishTransfersSem) < B_OK) continue; - // We have to acknowledge here after we get the TD list - // fHcca->done_head = 0; - // Write back WDH bit in the interrupt status register + + // 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); + + // Pull out the done list and reverse its order + // for both general and isochronous descriptors + addr_t done_list = fHcca->done_head & ~OHCI_DONE_INTERRUPTS; + addr_t logical = _LogicalAddress(done_list); + if (_IsIsochronous(logical)) { + ohci_general_td *descriptor = (ohci_general_td *)logical; + } else { + ohci_isochronous_td *descriptor = (ohci_isochronous_td *)logical; + } + + // Acknowledge the interrupt + fHcca->done_head = 0; + _WriteReg(OHCI_INTERRUPT_ENABLE, OHCI_WRITEBACK_DONE_HEAD); + } } +addr_t +OHCI::_LogicalAddress(addr_t physical) +{ + // How do I implement it ? + // 1 - Hash function like others (*BSD, Linux) + // 2 - Adding a method to our slab allocator ( + // offset from the base are the same for phys and logic) + return 0; +} + + +bool +OHCI::_IsIsochronous(addr_t logical) +{ + // I have NO IDEA how to implement this. + // BSD uses two hash table. + return false; +} + + status_t OHCI::Start() { @@ -461,6 +507,7 @@ status_t OHCI::SubmitTransfer(Transfer *transfer) { + // short circuit the root hub if (transfer->TransferPipe()->DeviceAddress() == fRootHubAddress) return fRootHub->ProcessTransfer(this, transfer); @@ -522,10 +569,11 @@ vector.iov_len = sizeof(usb_request_data); _WriteDescriptorChain(setupDescriptor, &vector, 1); + status_t result; if (transfer->VectorCount() > 0) { ohci_general_td *dataDescriptor = NULL; ohci_general_td *lastDescriptor = NULL; - status_t result = _CreateDescriptorChain(&dataDescriptor, + result = _CreateDescriptorChain(&dataDescriptor, &lastDescriptor, directionIn ? OHCI_TD_DIRECTION_PID_OUT : OHCI_TD_DIRECTION_PID_IN, transfer->VectorLength()); @@ -556,11 +604,28 @@ // 3. Tell the controller to process the control list _WriteReg(OHCI_COMMAND_STATUS, OHCI_CONTROL_LIST_FILLED); + result = _AddPendingTransfer(transfer, setupDescriptor, statusDescriptor, + directionIn); + if (result < B_OK) { + TRACE_ERROR(("usb_ohci: failed to add pending transfer\n")); + _FreeDescriptorChain(setupDescriptor); + return result; + } + return B_OK; } status_t +OHCI::_AddPendingTransfer(Transfer *transfer, ohci_general_td *first, + ohci_general_td *last, bool direction) +{ + // TODO + return B_ERROR; +} + + +status_t OHCI::_SubmitIsochronousTransfer(Transfer *transfer) { return B_ERROR; @@ -583,6 +648,13 @@ } +void +OHCI::_FreeDescriptorChain(ohci_general_td *top) +{ + // TODO +} + + size_t OHCI::_WriteDescriptorChain(ohci_general_td *topDescriptor, iovec *vector, size_t vectorCount) @@ -914,6 +986,20 @@ } +ohci_isochronous_td* +_CreateIsochronousDescriptor() +{ + // TODO + return NULL; +} + + +void _FreeIsochronousDescriptor(ohci_isochronous_td *descriptor) +{ + // TODO +} + + status_t OHCI::_InsertEndpointForPipe(Pipe *pipe) { Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ohci.h 2008-01-06 14:04:15 UTC (rev 23265) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ohci.h 2008-01-06 14:34:22 UTC (rev 23266) @@ -20,6 +20,7 @@ typedef struct transfer_data_s { Transfer *transfer; + ohci_general_td *top; bool incoming; bool canceled; transfer_data_s *link; @@ -80,6 +81,12 @@ static int32 _InterruptHandler(void *data); int32 _Interrupt(); + // Transfer functions + status_t _AddPendingTransfer(Transfer *transfer, + ohci_general_td *first, + ohci_general_td *last, + bool directionIn); + static int32 _FinishThread(void *data); void _FinishTransfer(); @@ -121,6 +128,10 @@ iovec *vector, size_t vectorCount); + // OHCI needs this function + addr_t _LogicalAddress(addr_t physical); + bool _IsIsochronous(addr_t logical); + // Register functions inline void _WriteReg(uint32 reg, uint32 value); inline uint32 _ReadReg(uint32 reg); Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci_hardware.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ohci_hardware.h 2008-01-06 14:04:15 UTC (rev 23265) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ohci_hardware.h 2008-01-06 14:34:22 UTC (rev 23266) @@ -375,7 +375,7 @@ { uint32 flags; uint32 buffer_page_byte_0; // Physical page number of byte 0 - uint32 next_descriptor; // Next isochronous transfer descriptor + uint32 next_physical_descriptor; // Next isochronous transfer descriptor uint32 last_byte_address; // Physical buffer end uint16 offset[OHCI_ITD_NOFFSET]; // Buffer offsets }; From axeld at mail.berlios.de Sun Jan 6 15:54:57 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 6 Jan 2008 15:54:57 +0100 Subject: [Haiku-commits] r23267 - haiku/trunk/src/system/kernel Message-ID: <200801061454.m06EsvKk032352@sheep.berlios.de> Author: axeld Date: 2008-01-06 15:54:57 +0100 (Sun, 06 Jan 2008) New Revision: 23267 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23267&view=rev Modified: haiku/trunk/src/system/kernel/elf.cpp Log: * elf_resolve_symbol() no longer copies the symbol name if symbolPrepend is NULL (it's not used anywhere yet, anyway). * Fixed warning when compiling with tracing turned on. * Some cleanup. Modified: haiku/trunk/src/system/kernel/elf.cpp =================================================================== --- haiku/trunk/src/system/kernel/elf.cpp 2008-01-06 14:34:22 UTC (rev 23266) +++ haiku/trunk/src/system/kernel/elf.cpp 2008-01-06 14:54:57 UTC (rev 23267) @@ -62,8 +62,7 @@ static bool sInitialized = false; -/** calculates hash for an image using its ID */ - +/*! Calculates hash for an image using its ID */ static uint32 image_hash(void *_image, const void *_key, uint32 range) { @@ -77,8 +76,7 @@ } -/** compares an image to a given ID */ - +/*! Compares an image to a given ID */ static int image_compare(void *_image, const void *_key) { @@ -117,8 +115,7 @@ } -/** Note, you must lock the image mutex when you call this function. */ - +/*! Note, you must lock the image mutex when you call this function. */ static struct elf_image_info * find_image_at_address(addr_t address) { @@ -481,28 +478,34 @@ neededOffset = d[i].d_un.d_ptr + image->text_region.delta; break; case DT_HASH: - image->symhash = (uint32 *)(d[i].d_un.d_ptr + image->text_region.delta); + image->symhash = (uint32 *)(d[i].d_un.d_ptr + + image->text_region.delta); break; case DT_STRTAB: - image->strtab = (char *)(d[i].d_un.d_ptr + image->text_region.delta); + image->strtab = (char *)(d[i].d_un.d_ptr + + image->text_region.delta); break; case DT_SYMTAB: - image->syms = (struct Elf32_Sym *)(d[i].d_un.d_ptr + image->text_region.delta); + image->syms = (struct Elf32_Sym *)(d[i].d_un.d_ptr + + image->text_region.delta); break; case DT_REL: - image->rel = (struct Elf32_Rel *)(d[i].d_un.d_ptr + image->text_region.delta); + image->rel = (struct Elf32_Rel *)(d[i].d_un.d_ptr + + image->text_region.delta); break; case DT_RELSZ: image->rel_len = d[i].d_un.d_val; break; case DT_RELA: - image->rela = (struct Elf32_Rela *)(d[i].d_un.d_ptr + image->text_region.delta); + image->rela = (struct Elf32_Rela *)(d[i].d_un.d_ptr + + image->text_region.delta); break; case DT_RELASZ: image->rela_len = d[i].d_un.d_val; break; case DT_JMPREL: - image->pltrel = (struct Elf32_Rel *)(d[i].d_un.d_ptr + image->text_region.delta); + image->pltrel = (struct Elf32_Rel *)(d[i].d_un.d_ptr + + image->text_region.delta); break; case DT_PLTRELSZ: image->pltrel_len = d[i].d_un.d_val; @@ -520,7 +523,7 @@ if (!image->symhash || !image->syms || !image->strtab) return B_ERROR; - TRACE(("needed_offset = %d\n", neededOffset)); + TRACE(("needed_offset = %ld\n", neededOffset)); if (neededOffset >= 0) image->needed = STRING(image, neededOffset); @@ -529,64 +532,74 @@ } -/** this function first tries to see if the first image and it's already resolved symbol is okay, otherwise - * it tries to link against the shared_image - * XXX gross hack and needs to be done better - */ - +/*! Resolves the \a symbol by linking against \a sharedImage if necessary. + Returns the resolved symbol's address in \a _symbolAddress. + TODO: eventually get rid of "symbolPrepend" +*/ status_t -elf_resolve_symbol(struct elf_image_info *image, struct Elf32_Sym *sym, - struct elf_image_info *shared_image, const char *sym_prepend, addr_t *sym_addr) +elf_resolve_symbol(struct elf_image_info *image, struct Elf32_Sym *symbol, + struct elf_image_info *sharedImage, const char *symbolPrepend, + addr_t *_symbolAddress) { - struct Elf32_Sym *sym2; - char new_symname[512]; + switch (symbol->st_shndx) { + case SHN_UNDEF: + { + struct Elf32_Sym *newSymbol; + char newNameBuffer[368]; + char *newName; - switch (sym->st_shndx) { - case SHN_UNDEF: // patch the symbol name - strlcpy(new_symname, sym_prepend, sizeof(new_symname)); - strlcat(new_symname, SYMNAME(image, sym), sizeof(new_symname)); + if (symbolPrepend) { + newName = newNameBuffer; + strlcpy(newName, symbolPrepend, sizeof(newName)); + strlcat(newName, SYMNAME(image, symbol), sizeof(newName)); + } else + newName = SYMNAME(image, symbol); // it's undefined, must be outside this image, try the other image - sym2 = elf_find_symbol(shared_image, new_symname); - if (!sym2) { + newSymbol = elf_find_symbol(sharedImage, newName); + if (newSymbol == NULL) { dprintf("\"%s\": could not resolve symbol '%s'\n", - image->name, new_symname); + image->name, newName); return B_MISSING_SYMBOL; } // make sure they're the same type - if (ELF32_ST_TYPE(sym->st_info) != ELF32_ST_TYPE(sym2->st_info)) { - dprintf("elf_resolve_symbol: found symbol '%s' in shared image but wrong type\n", new_symname); + if (ELF32_ST_TYPE(symbol->st_info) + != ELF32_ST_TYPE(newSymbol->st_info)) { + dprintf("elf_resolve_symbol: found symbol '%s' in shared image but wrong type\n", newName); return B_MISSING_SYMBOL; } - if (ELF32_ST_BIND(sym2->st_info) != STB_GLOBAL && ELF32_ST_BIND(sym2->st_info) != STB_WEAK) { - TRACE(("elf_resolve_symbol: found symbol '%s' but not exported\n", new_symname)); + if (ELF32_ST_BIND(newSymbol->st_info) != STB_GLOBAL + && ELF32_ST_BIND(newSymbol->st_info) != STB_WEAK) { + TRACE(("elf_resolve_symbol: found symbol '%s' but not exported\n", newName)); return B_MISSING_SYMBOL; } - *sym_addr = sym2->st_value + shared_image->text_region.delta; - return B_NO_ERROR; + *_symbolAddress = newSymbol->st_value + + sharedImage->text_region.delta; + return B_OK; + } case SHN_ABS: - *sym_addr = sym->st_value; - return B_NO_ERROR; + *_symbolAddress = symbol->st_value; + return B_OK; case SHN_COMMON: // ToDo: finish this TRACE(("elf_resolve_symbol: COMMON symbol, finish me!\n")); return B_ERROR; + default: // standard symbol - *sym_addr = sym->st_value + image->text_region.delta; - return B_NO_ERROR; + *_symbolAddress = symbol->st_value + image->text_region.delta; + return B_OK; } } -/** Until we have shared library support, just links against the kernel */ - +/*! Until we have shared library support, just links against the kernel */ static int -elf_relocate(struct elf_image_info *image, const char *sym_prepend) +elf_relocate(struct elf_image_info *image, const char *symbolPrepend) { int status = B_NO_ERROR; @@ -594,26 +607,33 @@ // deal with the rels first if (image->rel) { - TRACE(("total %i relocs\n", image->rel_len / (int)sizeof(struct Elf32_Rel))); + TRACE(("total %i relocs\n", + image->rel_len / (int)sizeof(struct Elf32_Rel))); - status = arch_elf_relocate_rel(image, sym_prepend, sKernelImage, image->rel, image->rel_len); + status = arch_elf_relocate_rel(image, symbolPrepend, sKernelImage, + image->rel, image->rel_len); if (status < B_OK) return status; } if (image->pltrel) { - TRACE(("total %i plt-relocs\n", image->pltrel_len / (int)sizeof(struct Elf32_Rel))); + TRACE(("total %i plt-relocs\n", + image->pltrel_len / (int)sizeof(struct Elf32_Rel))); - if (image->pltrel_type == DT_REL) - status = arch_elf_relocate_rel(image, sym_prepend, sKernelImage, image->pltrel, image->pltrel_len); - else - status = arch_elf_relocate_rela(image, sym_prepend, sKernelImage, (struct Elf32_Rela *)image->pltrel, image->pltrel_len); + if (image->pltrel_type == DT_REL) { + status = arch_elf_relocate_rel(image, symbolPrepend, sKernelImage, + image->pltrel, image->pltrel_len); + } else { + status = arch_elf_relocate_rela(image, symbolPrepend, sKernelImage, + (struct Elf32_Rela *)image->pltrel, image->pltrel_len); + } if (status < B_OK) return status; } if (image->rela) { - status = arch_elf_relocate_rela(image, sym_prepend, sKernelImage, image->rela, image->rela_len); + status = arch_elf_relocate_rela(image, symbolPrepend, sKernelImage, + image->rela, image->rela_len); if (status < B_OK) return status; } @@ -809,7 +829,7 @@ goto error1; if (!kernel) { - status = elf_relocate(image, ""); + status = elf_relocate(image, NULL); if (status < B_OK) goto error1; } else @@ -841,8 +861,7 @@ } -// #pragma mark - -// public kernel API +// #pragma mark - public kernel API status_t @@ -881,15 +900,13 @@ } -// #pragma mark - -// kernel private API +// #pragma mark - kernel private API -/** Looks up a symbol by address in all images loaded in kernel space. - * Note, if you need to call this function outside a debugger, make - * sure you fix locking and the way it returns its information, first! - */ - +/*! Looks up a symbol by address in all images loaded in kernel space. + Note, if you need to call this function outside a debugger, make + sure you fix locking and the way it returns its information, first! +*/ status_t elf_debug_lookup_symbol_address(addr_t address, addr_t *_baseAddress, const char **_symbolName, const char **_imageName, bool *_exactMatch) @@ -1322,7 +1339,7 @@ char regionName[B_OS_NAME_LENGTH]; elf_region *region; - TRACE(("looking at program header %d\n", i)); + TRACE(("looking at program header %ld\n", i)); switch (programHeaders[i].p_type) { case PT_LOAD: @@ -1410,7 +1427,7 @@ if (status < B_OK) goto error5; - status = elf_relocate(image, ""); + status = elf_relocate(image, NULL); if (status < B_OK) goto error5; From superstippi at gmx.de Sun Jan 6 16:58:33 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 06 Jan 2008 16:58:33 +0100 Subject: [Haiku-commits] r23267 - haiku/trunk/src/system/kernel In-Reply-To: <200801061454.m06EsvKk032352@sheep.berlios.de> References: <200801061454.m06EsvKk032352@sheep.berlios.de> Message-ID: <20080106165833.885.2@stippis2.1199632056.fake> Hi Axel, axeld at BerliOS wrote (2008-01-06, 15:54:57 [+0100]): > Author: axeld > Date: 2008-01-06 15:54:57 +0100 (Sun, 06 Jan 2008) New Revision: 23267 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23267&view=rev > > Modified: > haiku/trunk/src/system/kernel/elf.cpp > Log: > * elf_resolve_symbol() no longer copies the symbol name if symbolPrepend > is > NULL (it's not used anywhere yet, anyway). > * Fixed warning when compiling with tracing turned on. > * Some cleanup. one of your last commits (which sound really nice btw :-) broke the build for me: /Data/home/projects/develop/Haiku/src/tools/fs_shell/file_cache.cpp:253: warning: int format, fssh_mount_id arg (arg 2) C++ generated/objects/r5/x86/release/tools/fs_shell/file_map.o C++ generated/objects/r5/x86/release/tools/fs_shell/vfs.o Archive generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a /boot/develop/bin/ar: creating generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a Ranlib generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a Link generated/objects/r5/x86/release/tools/bfs_shell/bfs_shell generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::dir_vnode_to_path(FSShell::vnode *, char *, unsigned long)': vfs.cpp:(.text+0x132f): undefined reference to `FSShell::KPath::KPath(unsigned long)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::vfs_get_vnode_from_path(char const *, bool, void **)': vfs.cpp:(.text+0x24a2): undefined reference to `FSShell::KPath::KPath(unsigned long)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::vfs_get_fs_node_from_path(long, char const *, bool, void **)': vfs.cpp:(.text+0x2772): undefined reference to `FSShell::KPath::KPath(unsigned long)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::vfs_normalize_path(char const *, char *, unsigned long, bool)': vfs.cpp:(.text+0x2b3d): undefined reference to `FSShell::KPath::KPath(unsigned long)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::vfs_init(FSShell::kernel_args *)': vfs.cpp:(.text+0x328d): undefined reference to `FSShell::hash_init(unsigned long, int, int (*)(void *, void const *), unsigned long (*)(void *, void const *, unsigned long))' vfs.cpp:(.text+0x32bd): undefined reference to `FSShell::list_init_etc(FSShell::list *, long)' vfs.cpp:(.text+0x32d4): undefined reference to `FSShell::hash_init(unsigned long, int, int (*)(void *, void const *), unsigned long (*)(void *, void const *, unsigned long))' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::fs_mount(char *, char const *, char const *, unsigned long, char const *, bool)': vfs.cpp:(.text+0x5b74): undefined reference to `FSShell::KPath::KPath(unsigned long)' vfs.cpp:(.text+0x5b9f): undefined reference to `FSShell::KPath::SetTo(char const *, bool, unsigned long)' vfs.cpp:(.text+0x5c4a): undefined reference to `FSShell::list_init_etc(FSShell::list *, long)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::_kern_mount(char const *, char const *, char const *, unsigned long, char const *, unsigned long)': vfs.cpp:(.text+0x690d): undefined reference to `FSShell::KPath::KPath(char const *, bool, unsigned long)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::_kern_unmount(char const *, unsigned long)': vfs.cpp:(.text+0x69e9): undefined reference to `FSShell::KPath::KPath(char const *, bool, unsigned long)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::_kern_open(int, char const *, int, int)': vfs.cpp:(.text+0x6c40): undefined reference to `FSShell::KPath::KPath(char const *, bool, unsigned long)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::_kern_open_dir(int, char const *)': vfs.cpp:(.text+0x6d91): undefined reference to `FSShell::KPath::KPath(char const *, bool, unsigned long)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::_kern_create_dir(int, char const *, int)': vfs.cpp:(.text+0x6f59): undefined reference to `FSShell::KPath::KPath(char const *, bool, unsigned long)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o):vfs.cpp:(. text+0x7030): more undefined references to `FSShell::KPath::KPath(char const *, bool, unsigned long)' follow generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::_kern_open_attr_dir(int, char const *)': vfs.cpp:(.text+0x7b61): undefined reference to `FSShell::KPath::KPath(unsigned long)' vfs.cpp:(.text+0x7ba5): undefined reference to `FSShell::KPath::SetTo(char const *, bool, unsigned long)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(vfs.o): In function `FSShell::_kern_setcwd(int, char const *)': vfs.cpp:(.text+0x7e3d): undefined reference to `FSShell::KPath::KPath(unsigned long)' vfs.cpp:(.text+0x7e85): undefined reference to `FSShell::KPath::SetTo(char const *, bool, unsigned long)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(fssh.o): In function `FSShell::init_kernel(void)': fssh.cpp:(.text+0x12a): undefined reference to `FSShell::_kern_mount(char const *, char const *, char const *, unsigned int, char const *, unsigned int)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(fssh.o): In function `FSShell::command_ln(int, char const *const *)': fssh.cpp:(.text+0x11bc): undefined reference to `FSShell::_kern_read_stat(int, char const *, bool, fssh_stat *, unsigned int)' fssh.cpp:(.text+0x132b): undefined reference to `FSShell::_kern_read_stat(int, char const *, bool, fssh_stat *, unsigned int)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(fssh.o): In function `FSShell::list_entry(char const *, char const *)': fssh.cpp:(.text+0x15ac): undefined reference to `FSShell::_kern_read_stat(int, char const *, bool, fssh_stat *, unsigned int)' fssh.cpp:(.text+0x18d3): undefined reference to `FSShell::_kern_read_link(int, char const *, char *, unsigned int *)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(fssh.o): In function `FSShell::command_ls(int, char const *const *)': fssh.cpp:(.text+0x1d01): undefined reference to `FSShell::_kern_read_stat(int, char const *, bool, fssh_stat *, unsigned int)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(fssh.o): In function `FSShell::create_dir(char const *, bool)': fssh.cpp:(.text+0x1ecb): undefined reference to `FSShell::_kern_read_stat(int, char const *, bool, fssh_stat *, unsigned int)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(fssh.o): In function `FSShell::command_mkindex(int, char const *const *)': fssh.cpp:(.text+0x221e): undefined reference to `FSShell::_kern_read_stat(int, char const *, bool, fssh_stat *, unsigned int)' fssh.cpp:(.text+0x224d): undefined reference to `FSShell::_kern_create_index(int, char const *, unsigned int, unsigned int)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(fssh.o): In function `FSShell::remove_entry(int, char const *, bool, bool)': fssh.cpp:(.text+0x2439): undefined reference to `FSShell::_kern_read_stat(int, char const *, bool, fssh_stat *, unsigned int)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(fssh.o): In function `FSShell::read_command_line(char *, int)': fssh.cpp:(.text+0x27b3): undefined reference to `FSShell::_kern_getcwd(char *, unsigned int)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(fssh.o): In function `FSShell::standard_session(char const *, char const *, bool)': fssh.cpp:(.text+0x32cf): undefined reference to `FSShell::_kern_mount(char const *, char const *, char const *, unsigned int, char const *, unsigned int)' fssh.cpp:(.text+0x3322): undefined reference to `FSShell::_kern_unmount(char const *, unsigned int)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(command_cp.o): In function `FSShell::GuestFSDomain::Open(char const *, int, FSShell::Node *&)': command_cp.cpp:(.FSShell::GuestFSDomain::gnu.linkonce.t.Open(char const *, int, FSShell::Node *&)+0x53): undefined reference to `FSShell::_kern_read_stat(int, char const *, bool, fssh_stat *, unsigned int)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(command_cp.o): In function `FSShell::GuestNode::GetAttrInfo(char const *, fssh_attr_info &)': command_cp.cpp:(.FSShell::GuestNode::gnu.linkonce.t.GetAttrInfo(char const *, fssh_attr_info &)+0x46): undefined reference to `FSShell::_kern_read_stat(int, char const *, bool, fssh_stat *, unsigned int)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(command_cp.o): In function `FSShell::GuestNode::WriteAttr(char const *, unsigned int, long long, void const *, int)': command_cp.cpp:(.FSShell::GuestNode::gnu.linkonce.t.WriteAttr(char const *, unsigned int, long long, void const *, int)+0x27): undefined reference to `FSShell::_kern_create_attr(int, char const *, unsigned int, int)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(command_cp.o): In function `FSShell::GuestSymLink::ReadLink(char *, int)': command_cp.cpp:(.FSShell::GuestSymLink::gnu.linkonce.t.ReadLink(char *, int)+0x2b): undefined reference to `FSShell::_kern_read_link(int, char const *, char *, unsigned int *)' generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a(KPath.o): In function `FSShell::KPath::SetPath(char const *, bool)': KPath.cpp:(.text+0x224): undefined reference to `FSShell::vfs_normalize_path(char const *, char *, unsigned int, bool)' collect2: ld returned 1 exit status gcc -o "generated/objects/r5/x86/release/tools/bfs_shell/bfs_shell" "generated/objects/r5/x86/release/tools/bfs_shell/bfs_disk_system.o" "generated/objects/r5/x86/release/tools/bfs_shell/BlockAllocator.o" "generated/objects/r5/x86/release/tools/bfs_shell/BPlusTree.o" "generated/objects/r5/x86/release/tools/bfs_shell/Attribute.o" "generated/objects/r5/x86/release/tools/bfs_shell/Debug.o" "generated/objects/r5/x86/release/tools/bfs_shell/Index.o" "generated/objects/r5/x86/release/tools/bfs_shell/Inode.o" "generated/objects/r5/x86/release/tools/bfs_shell/Journal.o" "generated/objects/r5/x86/release/tools/bfs_shell/Query.o" "generated/objects/r5/x86/release/tools/bfs_shell/Utility.o" "generated/objects/r5/x86/release/tools/bfs_shell/Volume.o" "generated/objects/r5/x86/release/tools/bfs_shell/kernel_interface.o" "generated/objects/r5/x86/release/tools/fs_shell/fs_shell.a" "generated/objects/r5/x86/release/build/libhaikucompat/libhaikucompat_build. a" -lstdc++.r4 -lroot ; ...failed Link generated/objects/r5/x86/release/tools/bfs_shell/bfs_shell ... ...skipped haiku.image-init-vars for lack of bfs_shell... ...skipped install-haiku for lack of haiku.image-init-vars... ...failed updating 1 target(s)... ...skipped 2 target(s)... ...updated 5 target(s)... Best regards, -Stephan From axeld at mail.berlios.de Sun Jan 6 17:58:50 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 6 Jan 2008 17:58:50 +0100 Subject: [Haiku-commits] r23268 - haiku/trunk/src/add-ons/kernel/network/stack Message-ID: <200801061658.m06Gwotq006212@sheep.berlios.de> Author: axeld Date: 2008-01-06 17:58:50 +0100 (Sun, 06 Jan 2008) New Revision: 23268 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23268&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/stack/net_buffer.cpp Log: * init_first_data_node() did not always set tail_space correctly, leading to potential data corruption. This fixes bug #1388. * get_node_at_offset() would return a node too early in the list if the offset fell on a node boundary - didn't cause any actual harm, though. * append_size(): renamed variable tailSpace to previousTailSpace to make it clearer. * Improved debug output for duplicate_buffer() and clone_buffer(). * Debug output is now prepended by the thread ID. Modified: haiku/trunk/src/add-ons/kernel/network/stack/net_buffer.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/net_buffer.cpp 2008-01-06 14:54:57 UTC (rev 23267) +++ haiku/trunk/src/add-ons/kernel/network/stack/net_buffer.cpp 2008-01-06 16:58:50 UTC (rev 23268) @@ -143,7 +143,7 @@ header->first_free = NULL; header->first_node = NULL; - TRACE((" create new data header %p\n", header)); + TRACE(("%ld: create new data header %p\n", find_thread(NULL), header)); return header; } @@ -154,7 +154,7 @@ if (atomic_add(&header->ref_count, -1) != 1) return; - TRACE((" free header %p\n", header)); + TRACE(("%ld: free header %p\n", find_thread(NULL), header)); free_data_header(header); } @@ -242,7 +242,7 @@ node->start = header->data_end + header->data_space; node->used = 0; node->header_space = header->data_space; - node->tail_space = MAX_FREE_BUFFER_SIZE - header->data_space; + node->tail_space = (uint8 *)header + BUFFER_SIZE - node->start; header->first_node = node; } @@ -259,7 +259,9 @@ if (node == NULL) return NULL; - TRACE((" add data node %p to header %p\n", node, header)); + TRACE(("%ld: add data node %p to header %p\n", find_thread(NULL), node, + header)); + acquire_data_header(header); if (located != header) acquire_data_header(located); @@ -276,8 +278,8 @@ { data_header *located = node->located; - TRACE((" remove data node %p from header %p (located %p)\n", - node, node->header, located)); + TRACE(("%ld: remove data node %p from header %p (located %p)\n", + find_thread(NULL), node, node->header, located)); if (located != node->header) release_data_header(node->header); @@ -299,7 +301,7 @@ get_node_at_offset(net_buffer_private *buffer, size_t offset) { data_node *node = (data_node *)list_get_first_item(&buffer->buffers); - while (node->offset + node->used < offset) { + while (node->offset + node->used <= offset) { node = (data_node *)list_get_next_item(&buffer->buffers, node); if (node == NULL) return NULL; @@ -336,7 +338,7 @@ if (buffer == NULL) return NULL; - TRACE(("create buffer %p\n", buffer)); + TRACE(("%ld: create buffer %p\n", find_thread(NULL), buffer)); data_header *header = create_data_header(headerSpace); if (header == NULL) { @@ -373,7 +375,7 @@ { net_buffer_private *buffer = (net_buffer_private *)_buffer; - TRACE(("free buffer %p\n", buffer)); + TRACE(("%ld: free buffer %p\n", find_thread(NULL), buffer)); data_node *node; while ((node = (data_node *)list_remove_head_item(&buffer->buffers)) != NULL) { @@ -392,10 +394,14 @@ { net_buffer_private *buffer = (net_buffer_private *)_buffer; + TRACE(("%ld: duplicate_buffer(buffer %p)\n", find_thread(NULL), buffer)); + net_buffer *duplicate = create_buffer(buffer->first_node.header_space); if (duplicate == NULL) return NULL; + TRACE(("%ld: duplicate: %p)\n", find_thread(NULL), duplicate)); + // copy the data from the source buffer data_node *node = (data_node *)list_get_first_item(&buffer->buffers); @@ -429,12 +435,14 @@ { net_buffer_private *buffer = (net_buffer_private *)_buffer; - TRACE(("clone_buffer(buffer %p)\n", buffer)); + TRACE(("%ld: clone_buffer(buffer %p)\n", find_thread(NULL), buffer)); net_buffer_private *clone = allocate_net_buffer(); if (clone == NULL) return NULL; + TRACE(("%ld: clone: %p\n", find_thread(NULL), buffer)); + data_node *sourceNode = (data_node *)list_get_first_item(&buffer->buffers); if (sourceNode == NULL) { free_net_buffer(clone); @@ -504,7 +512,8 @@ if (buffer == NULL) return NULL; - TRACE(("split_buffer(buffer %p -> %p, offset %ld)\n", from, buffer, offset)); + TRACE(("%ld: split_buffer(buffer %p -> %p, offset %ld)\n", + find_thread(NULL), from, buffer, offset)); if (trim_data(buffer, offset) == B_OK) { if (remove_header(from, offset) == B_OK) @@ -530,7 +539,8 @@ if (with == NULL) return B_BAD_VALUE; - TRACE(("merge buffer %p with %p (%s)\n", buffer, with, after ? "after" : "before")); + TRACE(("%ld: merge buffer %p with %p (%s)\n", find_thread(NULL), buffer, + with, after ? "after" : "before")); //dump_buffer(buffer); //dprintf("with:\n"); //dump_buffer(with); @@ -685,8 +695,8 @@ net_buffer_private *buffer = (net_buffer_private *)_buffer; data_node *node = (data_node *)list_get_first_item(&buffer->buffers); - TRACE(("prepend_size(buffer %p, size %ld) [has %ld]\n", buffer, size, - node->header_space)); + TRACE(("%ld: prepend_size(buffer %p, size %ld) [has %u]\n", + find_thread(NULL), buffer, size, node->header_space)); //dump_buffer(buffer); if (node->header_space < size) { @@ -779,7 +789,8 @@ net_buffer_private *buffer = (net_buffer_private *)_buffer; data_node *node = (data_node *)list_get_last_item(&buffer->buffers); - TRACE(("append_size(buffer %p, size %ld)\n", buffer, size)); + TRACE(("%ld: append_size(buffer %p, size %ld)\n", find_thread(NULL), + buffer, size)); //dump_buffer(buffer); if (node->tail_space < size) { @@ -787,19 +798,19 @@ // compute how many buffers we're going to need // TODO: this doesn't leave any tail space, if that should be desired... - uint32 tailSpace = node->tail_space; + uint32 previousTailSpace = node->tail_space; uint32 minimalHeaderSpace = sizeof(data_header) + 3 * sizeof(data_node); - uint32 sizeNeeded = size - tailSpace; + uint32 sizeNeeded = size - previousTailSpace; uint32 count = (sizeNeeded + BUFFER_SIZE - minimalHeaderSpace - 1) / (BUFFER_SIZE - minimalHeaderSpace); uint32 headerSpace = BUFFER_SIZE - sizeNeeded / count - sizeof(data_header); uint32 sizeUsed = MAX_FREE_BUFFER_SIZE - headerSpace; - uint32 sizeAdded = tailSpace; + uint32 sizeAdded = previousTailSpace; // allocate space left in the node - node->tail_space -= tailSpace; - node->used += tailSpace; - buffer->size += tailSpace; + node->tail_space = 0; + node->used += previousTailSpace; + buffer->size += previousTailSpace; // allocate all buffers @@ -883,7 +894,8 @@ if (bytes > buffer->size) return B_BAD_VALUE; - TRACE(("remove_header(buffer %p, %ld bytes)\n", buffer, bytes)); + TRACE(("%ld: remove_header(buffer %p, %ld bytes)\n", find_thread(NULL), + buffer, bytes)); //dump_buffer(buffer); size_t left = bytes; @@ -951,8 +963,8 @@ trim_data(net_buffer *_buffer, size_t newSize) { net_buffer_private *buffer = (net_buffer_private *)_buffer; - TRACE(("trim_data(buffer %p, newSize = %ld, buffer size = %ld)\n", - buffer, newSize, buffer->size)); + TRACE(("%ld: trim_data(buffer %p, newSize = %ld, buffer size = %ld)\n", + find_thread(NULL), buffer, newSize, buffer->size)); //dump_buffer(buffer); if (newSize > buffer->size) @@ -1002,8 +1014,8 @@ net_buffer_private *buffer = (net_buffer_private *)_buffer; net_buffer_private *source = (net_buffer_private *)_source; - TRACE(("append_cloned_data(buffer %p, source %p, offset = %ld, bytes = %ld)\n", - buffer, source, offset, bytes)); + TRACE(("%ld: append_cloned_data(buffer %p, source %p, offset = %ld, " + "bytes = %ld)\n", find_thread(NULL), buffer, source, offset, bytes)); if (source->size < offset + bytes || source->size < offset) return B_BAD_VALUE; From stippi at mail.berlios.de Sun Jan 6 19:01:48 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Jan 2008 19:01:48 +0100 Subject: [Haiku-commits] r23269 - haiku/trunk/src/servers/app Message-ID: <200801061801.m06I1ma9022447@sheep.berlios.de> Author: stippi Date: 2008-01-06 19:01:47 +0100 (Sun, 06 Jan 2008) New Revision: 23269 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23269&view=rev Modified: haiku/trunk/src/servers/app/FontEngine.cpp Log: patch by Anthony Lee: * fixed bitmap fonts for real (applied the wrong patch last time) * some cleanup for coding style by myself (in other places) Modified: haiku/trunk/src/servers/app/FontEngine.cpp =================================================================== --- haiku/trunk/src/servers/app/FontEngine.cpp 2008-01-06 16:58:50 UTC (rev 23268) +++ haiku/trunk/src/servers/app/FontEngine.cpp 2008-01-06 18:01:47 UTC (rev 23269) @@ -332,12 +332,25 @@ } for (i = 0; i < bitmap.rows; i++) { sl.reset_spans(); - const uint8* p = buf; - for (j = 0; j < bitmap.width; j++) { - if (*p) - sl.add_cell(x + j, *p); - ++p; - } + + if (bitmap.pixel_mode == FT_PIXEL_MODE_MONO) { + // font has built-in mono bitmap + agg::bitset_iterator bits(buf, 0); + int j; + for (j = 0; j < bitmap.width; j++) { + if (bits.bit()) + sl.add_cell(x + j, agg::cover_full); + ++bits; + } + } else { + const uint8* p = buf; + for (j = 0; j < bitmap.width; j++) { + if (*p) + sl.add_cell(x + j, *p); + ++p; + } + } + buf += pitch; if (sl.num_spans()) { sl.finalize(y - i - 1); @@ -422,46 +435,41 @@ switch(fGlyphRendering) { case glyph_ren_native_mono: + fLastError = FT_Render_Glyph(fFace->glyph, FT_RENDER_MODE_MONO); + if (fLastError == 0) { + decompose_ft_bitmap_mono(fFace->glyph->bitmap, + fFace->glyph->bitmap_left, kFlipY ? + -fFace->glyph->bitmap_top : fFace->glyph->bitmap_top, + kFlipY, fScanlineBin, fScanlineStorageBin); + fBounds.x1 = fScanlineStorageBin.min_x(); + fBounds.y1 = fScanlineStorageBin.min_y(); + fBounds.x2 = fScanlineStorageBin.max_x(); + fBounds.y2 = fScanlineStorageBin.max_y(); + fDataSize = fScanlineStorageBin.byte_size(); + fDataType = glyph_data_mono; + return true; + } + break; + + case glyph_ren_native_gray8: - fLastError = FT_Render_Glyph(fFace->glyph, - fGlyphRendering == glyph_ren_native_mono ? - FT_RENDER_MODE_MONO : FT_RENDER_MODE_NORMAL); + fLastError = FT_Render_Glyph(fFace->glyph, FT_RENDER_MODE_NORMAL); if (fLastError == 0) { - switch (fFace->glyph->bitmap.pixel_mode) { - case FT_PIXEL_MODE_MONO: - decompose_ft_bitmap_mono(fFace->glyph->bitmap, - fFace->glyph->bitmap_left, - kFlipY ? -fFace->glyph->bitmap_top - : fFace->glyph->bitmap_top, - kFlipY, fScanlineBin, fScanlineStorageBin); - fBounds.x1 = fScanlineStorageBin.min_x(); - fBounds.y1 = fScanlineStorageBin.min_y(); - fBounds.x2 = fScanlineStorageBin.max_x(); - fBounds.y2 = fScanlineStorageBin.max_y(); - fDataSize = fScanlineStorageBin.byte_size(); - fDataType = glyph_data_mono; - return true; - - case FT_PIXEL_MODE_GRAY: - decompose_ft_bitmap_gray8(fFace->glyph->bitmap, - fFace->glyph->bitmap_left, - kFlipY ? -fFace->glyph->bitmap_top - : fFace->glyph->bitmap_top, - kFlipY, fScanlineAA, fScanlineStorageAA); - fBounds.x1 = fScanlineStorageAA.min_x(); - fBounds.y1 = fScanlineStorageAA.min_y(); - fBounds.x2 = fScanlineStorageAA.max_x(); - fBounds.y2 = fScanlineStorageAA.max_y(); - fDataSize = fScanlineStorageAA.byte_size(); - fDataType = glyph_data_gray8; - return true; - - default: - break; - } + decompose_ft_bitmap_gray8(fFace->glyph->bitmap, + fFace->glyph->bitmap_left, kFlipY ? + -fFace->glyph->bitmap_top : fFace->glyph->bitmap_top, + kFlipY, fScanlineAA, fScanlineStorageAA); + fBounds.x1 = fScanlineStorageAA.min_x(); + fBounds.y1 = fScanlineStorageAA.min_y(); + fBounds.x2 = fScanlineStorageAA.max_x(); + fBounds.y2 = fScanlineStorageAA.max_y(); + fDataSize = fScanlineStorageAA.byte_size(); + fDataType = glyph_data_gray8; + return true; } break; - + + case glyph_ren_outline: fPath.remove_all(); if (decompose_ft_outline(fFace->glyph->outline, kFlipY, fPath)) { @@ -513,8 +521,7 @@ { if (fFace && first && second && FT_HAS_KERNING(fFace)) { FT_Vector delta; - FT_Get_Kerning(fFace, first, second, - FT_KERNING_DEFAULT, &delta); + FT_Get_Kerning(fFace, first, second, FT_KERNING_DEFAULT, &delta); double dx = int26p6_to_dbl(delta.x); double dy = int26p6_to_dbl(delta.y); @@ -545,16 +552,11 @@ FT_Done_Face(fFace); if (fontFileBuffer && fontFileBufferSize) { - fLastError = FT_New_Memory_Face(fLibrary, - (const FT_Byte*)fontFileBuffer, - fontFileBufferSize, - faceIndex, - &fFace); + fLastError = FT_New_Memory_Face(fLibrary, + (const FT_Byte*)fontFileBuffer, fontFileBufferSize, + faceIndex, &fFace); } else { - fLastError = FT_New_Face(fLibrary, - fontFilePath, - faceIndex, - &fFace); + fLastError = FT_New_Face(fLibrary, fontFilePath, faceIndex, &fFace); } if (fLastError != 0) From superstippi at gmx.de Sun Jan 6 19:15:02 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 06 Jan 2008 19:15:02 +0100 Subject: [Haiku-commits] r23267 - haiku/trunk/src/system/kernel In-Reply-To: <20080106165833.885.2@stippis2.1199632056.fake> References: <200801061454.m06EsvKk032352@sheep.berlios.de> <20080106165833.885.2@stippis2.1199632056.fake> Message-ID: <20080106191502.3302.2@stippis2.1199641758.fake> Stephan Assmus wrote (2008-01-06, 16:58:33 [+0100]): > Hi Axel, > > axeld at BerliOS wrote (2008-01-06, 15:54:57 [+0100]): > > Author: axeld > > Date: 2008-01-06 15:54:57 +0100 (Sun, 06 Jan 2008) New Revision: 23267 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23267&view=rev > > > > Modified: > > haiku/trunk/src/system/kernel/elf.cpp > > Log: > > * elf_resolve_symbol() no longer copies the symbol name if > > symbolPrepend > > is > > NULL (it's not used anywhere yet, anyway). > > * Fixed warning when compiling with tracing turned on. > > * Some cleanup. > > one of your last commits (which sound really nice btw :-) broke the build > for me: Please ignore my post. I have a really weird development setup where I need to switch compilers/headers between R5/ZETA in order to build the app_server test environment on ZETA. I forgot to switch and it caused a mixup. Everything seems to be fine again. Best regards, -Stephan From stippi at mail.berlios.de Sun Jan 6 20:02:01 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Jan 2008 20:02:01 +0100 Subject: [Haiku-commits] r23270 - haiku/trunk/src/servers/registrar Message-ID: <200801061902.m06J216G000500@sheep.berlios.de> Author: stippi Date: 2008-01-06 20:02:00 +0100 (Sun, 06 Jan 2008) New Revision: 23270 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23270&view=rev Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.cpp Log: patch by Alexandre Deckner (aldeck): * improve the placement of text in the shutdown window * define constants for the width of the "stripe" and icon size Thanks! Fixes #1697. Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.cpp =================================================================== --- haiku/trunk/src/servers/registrar/ShutdownProcess.cpp 2008-01-06 18:01:47 UTC (rev 23269) +++ haiku/trunk/src/servers/registrar/ShutdownProcess.cpp 2008-01-06 19:02:00 UTC (rev 23270) @@ -61,6 +61,9 @@ // the shutdown window before closing it automatically. static const bigtime_t kDisplayAbortingAppTimeout = 3000000; // 3 s +static const int kStripeWidth = 30; +static const int kIconVSpacing = 6; +static const int kIconSize = 32; // message what fields (must not clobber the registrar's message namespace) enum { @@ -248,7 +251,7 @@ // create the views // root view - fRootView = new(nothrow) TAlertView(BRect(0, 0, 100, 15), "app icons", + fRootView = new(nothrow) TAlertView(BRect(0, 0, 10, 10), "app icons", B_FOLLOW_NONE, 0); if (!fRootView) return B_NO_MEMORY; @@ -351,8 +354,7 @@ fTextView->SetText("two\nlines"); int textHeight = (int)fTextView->TextHeight(0, 1) + 1; - int rightPartX = fRootView->Frame().IntegerWidth() - + 1; + int rightPartX = kStripeWidth + kIconSize / 2 + 1; int textX = rightPartX + kInnerHSpacing; int textY = kVSpacing; int buttonsY = textY + textHeight + kInnerVSpacing; @@ -533,7 +535,7 @@ virtual void Draw(BRect updateRect) { BRect stripeRect = Bounds(); - stripeRect.right = 30; + stripeRect.right = kStripeWidth; SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); FillRect(stripeRect); @@ -544,7 +546,8 @@ } else SetDrawingMode(B_OP_OVER); - DrawBitmapAsync(fAppInfo->largeIcon, BPoint(18, 6)); + DrawBitmapAsync(fAppInfo->largeIcon, + BPoint(kStripeWidth - kIconSize / 2, kIconVSpacing)); } } From axeld at pinc-software.de Sun Jan 6 20:16:19 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Sun, 06 Jan 2008 20:16:19 +0100 CET Subject: [Haiku-commits] r23267 - haiku/trunk/src/system/kernel In-Reply-To: <20080106191502.3302.2@stippis2.1199641758.fake> Message-ID: <31113749491-BeMail@zon> Stephan Assmus wrote: > > one of your last commits (which sound really nice btw :-) broke the > > build > > for me: > Please ignore my post. I have a really weird development setup where > I need > to switch compilers/headers between R5/ZETA in order to build the > app_server test environment on ZETA. I forgot to switch and it caused > a > mixup. Everything seems to be fine again. Thanks for the update! :-) I just tested, and it worked fine here (I was also pretty sure I didn't do anything which could have caused this). Bye, Axel. From stippi at mail.berlios.de Sun Jan 6 21:09:56 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Jan 2008 21:09:56 +0100 Subject: [Haiku-commits] r23271 - haiku/trunk/src/servers/app Message-ID: <200801062009.m06K9uYG006519@sheep.berlios.de> Author: stippi Date: 2008-01-06 21:09:55 +0100 (Sun, 06 Jan 2008) New Revision: 23271 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23271&view=rev Modified: haiku/trunk/src/servers/app/DefaultDecorator.cpp haiku/trunk/src/servers/app/WindowLayer.cpp haiku/trunk/src/servers/app/WindowLayer.h Log: * removed no longer valid TODOs * cleanup the code in a few places * fixed a bug where the border region would not be made empty if there was a decorator previously, but there is no new one * slight improvement for memory footprint of WindowLayer by using bit fields for more of the flags Modified: haiku/trunk/src/servers/app/DefaultDecorator.cpp =================================================================== --- haiku/trunk/src/servers/app/DefaultDecorator.cpp 2008-01-06 19:02:00 UTC (rev 23270) +++ haiku/trunk/src/servers/app/DefaultDecorator.cpp 2008-01-06 20:09:55 UTC (rev 23271) @@ -474,9 +474,9 @@ if (fLook == B_NO_BORDER_WINDOW_LOOK) return; + region->Include(fTopBorder); region->Include(fLeftBorder); region->Include(fRightBorder); - region->Include(fTopBorder); region->Include(fBottomBorder); if (fLook == B_BORDERED_WINDOW_LOOK) Modified: haiku/trunk/src/servers/app/WindowLayer.cpp =================================================================== --- haiku/trunk/src/servers/app/WindowLayer.cpp 2008-01-06 19:02:00 UTC (rev 23270) +++ haiku/trunk/src/servers/app/WindowLayer.cpp 2008-01-06 20:09:55 UTC (rev 23271) @@ -76,15 +76,16 @@ fVisibleRegion(), fVisibleContentRegion(), - fVisibleContentRegionValid(false), fDirtyRegion(), fDirtyCause(0), fBorderRegion(), - fBorderRegionValid(false), fContentRegion(), - fContentRegionValid(false), fEffectiveDrawingRegion(), + + fVisibleContentRegionValid(false), + fBorderRegionValid(false), + fContentRegionValid(false), fEffectiveDrawingRegionValid(false), fRegionPool(), @@ -203,11 +204,9 @@ // TODO: if someone needs to call this from // the outside, the clipping needs to be readlocked! + // start from the decorator border, extend to use the frame GetBorderRegion(region); - - // start from the frame, extend to include decorator border region->Include(fFrame); - } // GetBorderRegion @@ -218,25 +217,11 @@ // the outside, the clipping needs to be readlocked! if (!fBorderRegionValid) { - // TODO: checkup Decorator::GetFootPrint() to see if it is as fast as this: -/* fBorderRegion.Set(BRect(fFrame.left - 4, fFrame.top - 20, - (fFrame.left + fFrame.right) / 2, fFrame.top - 5)); - fBorderRegion.Include(BRect(fFrame.left - 4, fFrame.top - 4, - fFrame.right + 4, fFrame.top - 1)); - fBorderRegion.Include(BRect(fFrame.left - 4, fFrame.top, - fFrame.left - 1, fFrame.bottom)); - fBorderRegion.Include(BRect(fFrame.right + 1, fFrame.top, - fFrame.right + 4, fFrame.bottom - 11)); - fBorderRegion.Include(BRect(fFrame.left - 4, fFrame.bottom + 1, - fFrame.right - 11, fFrame.bottom + 4)); - fBorderRegion.Include(BRect(fFrame.right - 10, fFrame.bottom - 10, - fFrame.right + 4, fFrame.bottom + 4));*/ - - // TODO: remove and use Decorator::GetFootPrint() - // start from the frame, extend to include decorator border - if (fDecorator) { + if (fDecorator) fDecorator->GetFootprint(&fBorderRegion); - } + else + fBorderRegion.MakeEmpty(); + fBorderRegionValid = true; } Modified: haiku/trunk/src/servers/app/WindowLayer.h =================================================================== --- haiku/trunk/src/servers/app/WindowLayer.h 2008-01-06 19:02:00 UTC (rev 23270) +++ haiku/trunk/src/servers/app/WindowLayer.h 2008-01-06 20:09:55 UTC (rev 23271) @@ -250,7 +250,6 @@ BRegion fVisibleRegion; BRegion fVisibleContentRegion; - bool fVisibleContentRegionValid; // our part of the "global" dirty region // it is calculated from the desktop thread, // but we can write to it when we read locked @@ -261,24 +260,26 @@ // caching local regions BRegion fBorderRegion; - bool fBorderRegionValid; BRegion fContentRegion; - bool fContentRegionValid; BRegion fEffectiveDrawingRegion; - bool fEffectiveDrawingRegionValid; + bool fVisibleContentRegionValid : 1; + bool fBorderRegionValid : 1; + bool fContentRegionValid : 1; + bool fEffectiveDrawingRegionValid : 1; + ::RegionPool fRegionPool; BObjectList fSubsets; // TODO: remove those some day (let the decorator handle that stuff) - bool fIsClosing; - bool fIsMinimizing; - bool fIsZooming; - bool fIsResizing; - bool fIsSlidingTab; - bool fIsDragging; - bool fActivateOnMouseUp; + bool fIsClosing : 1; + bool fIsMinimizing : 1; + bool fIsZooming : 1; + bool fIsResizing : 1; + bool fIsSlidingTab : 1; + bool fIsDragging : 1; + bool fActivateOnMouseUp : 1; ::Decorator* fDecorator; ViewLayer* fTopLayer; From stippi at mail.berlios.de Sun Jan 6 21:20:38 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Jan 2008 21:20:38 +0100 Subject: [Haiku-commits] r23272 - haiku/trunk/src/servers/app Message-ID: <200801062020.m06KKctr007385@sheep.berlios.de> Author: stippi Date: 2008-01-06 21:20:37 +0100 (Sun, 06 Jan 2008) New Revision: 23272 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23272&view=rev Modified: haiku/trunk/src/servers/app/WindowLayer.cpp haiku/trunk/src/servers/app/WindowLayer.h Log: * made transfering the pending to the current update session a bit faster by toggling pointers instead of assigning/transfering regions Modified: haiku/trunk/src/servers/app/WindowLayer.cpp =================================================================== --- haiku/trunk/src/servers/app/WindowLayer.cpp 2008-01-06 20:09:55 UTC (rev 23271) +++ haiku/trunk/src/servers/app/WindowLayer.cpp 2008-01-06 20:20:37 UTC (rev 23272) @@ -107,8 +107,8 @@ fLastMousePosition(0.0, 0.0), fLastMoveTime(0), - fCurrentUpdateSession(), - fPendingUpdateSession(), + fCurrentUpdateSession(&fUpdateSessions[0]), + fPendingUpdateSession(&fUpdateSessions[1]), fUpdateRequested(false), fInUpdate(false), @@ -293,10 +293,10 @@ if (fContentRegionValid) fContentRegion.OffsetBy(x, y); - if (fCurrentUpdateSession.IsUsed()) - fCurrentUpdateSession.MoveBy(x, y); - if (fPendingUpdateSession.IsUsed()) - fPendingUpdateSession.MoveBy(x, y); + if (fCurrentUpdateSession->IsUsed()) + fCurrentUpdateSession->MoveBy(x, y); + if (fPendingUpdateSession->IsUsed()) + fPendingUpdateSession->MoveBy(x, y); fEffectiveDrawingRegionValid = false; @@ -437,10 +437,12 @@ // move along the already dirty regions that are common // with the region that we could copy _ShiftPartOfRegion(&fDirtyRegion, region, xOffset, yOffset); - if (fPendingUpdateSession.IsUsed()) - _ShiftPartOfRegion(&fPendingUpdateSession.DirtyRegion(), region, xOffset, yOffset); + if (fPendingUpdateSession->IsUsed()) { + _ShiftPartOfRegion(&(fPendingUpdateSession->DirtyRegion()), region, + xOffset, yOffset); + } - if (fCurrentUpdateSession.IsUsed()) { + if (fCurrentUpdateSession->IsUsed()) { // if there are parts in the current update session // that intersect with the copied region, we cannot // simply shift them as with the other dirty regions @@ -449,10 +451,10 @@ // new dirty region instead BRegion* common = fRegionPool.GetRegion(*region); // see if there is a common part at all - common->IntersectWith(&fCurrentUpdateSession.DirtyRegion()); + common->IntersectWith(&fCurrentUpdateSession->DirtyRegion()); if (common->CountRects() > 0) { // cut the common part from the region - fCurrentUpdateSession.DirtyRegion().Exclude(common); + fCurrentUpdateSession->DirtyRegion().Exclude(common); newDirty->Include(common); } fRegionPool.Recycle(common); @@ -549,10 +551,10 @@ if (fUpdateRequested && !fInUpdate) { // we requested an update, but the client has not started it yet, // so it is only allowed to draw outside the pending update sessions region - fEffectiveDrawingRegion.Exclude(&fPendingUpdateSession.DirtyRegion()); + fEffectiveDrawingRegion.Exclude(&(fPendingUpdateSession->DirtyRegion())); } else if (fInUpdate) { // enforce the dirty region of the update session - fEffectiveDrawingRegion.IntersectWith(&fCurrentUpdateSession.DirtyRegion()); + fEffectiveDrawingRegion.IntersectWith(&fCurrentUpdateSession->DirtyRegion()); } else { // not in update, the view can draw everywhere //printf("WindowLayer(%s)::GetEffectiveDrawingRegion(for %s) - outside update\n", Title(), layer->Name()); @@ -1679,12 +1681,12 @@ if (IsVisible() && dirtyContentRegion.CountRects() > 0) { // put this into the pending dirty region // to eventually trigger a client redraw - bool wasExpose = fPendingUpdateSession.IsExpose(); + bool wasExpose = fPendingUpdateSession->IsExpose(); BRegion* backgroundClearingRegion = &dirtyContentRegion; _TransferToUpdateSession(&dirtyContentRegion); - if (fPendingUpdateSession.IsExpose()) { + if (fPendingUpdateSession->IsExpose()) { if (!fContentRegionValid) _UpdateContentRegion(); @@ -1692,7 +1694,7 @@ // there was suddenly added a dirty region // caused by exposing content, we need to clear // the entire background - backgroundClearingRegion = &fPendingUpdateSession.DirtyRegion(); + backgroundClearingRegion = &(fPendingUpdateSession->DirtyRegion()); } if (fDrawingEngine->LockParallelAccess()) { @@ -1767,10 +1769,10 @@ //snooze(10000); // add to pending - fPendingUpdateSession.SetUsed(true); -// if (!fPendingUpdateSession.IsExpose()) - fPendingUpdateSession.AddCause(fDirtyCause); - fPendingUpdateSession.Include(contentDirtyRegion); + fPendingUpdateSession->SetUsed(true); +// if (!fPendingUpdateSession->IsExpose()) + fPendingUpdateSession->AddCause(fDirtyCause); + fPendingUpdateSession->Include(contentDirtyRegion); // clip pending update session from current // update session, it makes no sense to draw stuff @@ -1784,8 +1786,8 @@ // until everything settles down. Potentially, this could even give // the impression of faster updates, even though they might look // wrong when looked at closer, but will fix themselves shortly later -// if (fCurrentUpdateSession.IsUsed() && fCurrentUpdateSession.IsExpose()) { -// fCurrentUpdateSession.Exclude(contentDirtyRegion); +// if (fCurrentUpdateSession->IsUsed() && fCurrentUpdateSession->IsExpose()) { +// fCurrentUpdateSession->Exclude(contentDirtyRegion); // fEffectiveDrawingRegionValid = false; // } @@ -1823,10 +1825,11 @@ if (fUpdateRequested) { // make the pending update session the current update session - // TODO: the toggling between the update sessions is too - // expensive, optimize with some pointer tricks + // (toggle the pointers) + UpdateSession* temp = fCurrentUpdateSession; fCurrentUpdateSession = fPendingUpdateSession; - fPendingUpdateSession.SetUsed(false); + fPendingUpdateSession = temp; + fPendingUpdateSession->SetUsed(false); // all drawing command from the client // will have the dirty region from the update // session enforced @@ -1842,7 +1845,7 @@ _UpdateContentRegion(); BRegion* dirty = fRegionPool.GetRegion( - fCurrentUpdateSession.DirtyRegion()); + fCurrentUpdateSession->DirtyRegion()); if (!dirty) { link.StartMessage(B_ERROR); link.Flush(); @@ -1875,7 +1878,7 @@ link.Attach(B_NULL_TOKEN); link.Flush(); - if (!fCurrentUpdateSession.IsExpose() && fDrawingEngine->LockParallelAccess()) { + if (!fCurrentUpdateSession->IsExpose() && fDrawingEngine->LockParallelAccess()) { //fDrawingEngine->FillRegion(dirty, (rgb_color){ 255, 0, 0, 255 }); fDrawingEngine->SuspendAutoSync(); @@ -1903,12 +1906,12 @@ // NOTE: see comment in _BeginUpdate() if (fInUpdate) { - fCurrentUpdateSession.SetUsed(false); + fCurrentUpdateSession->SetUsed(false); fInUpdate = false; fEffectiveDrawingRegionValid = false; } - if (fPendingUpdateSession.IsUsed()) { + if (fPendingUpdateSession->IsUsed()) { // send this to client _SendUpdateMessage(); } else { @@ -2054,12 +2057,3 @@ } -WindowLayer::UpdateSession& -WindowLayer::UpdateSession::operator=(const WindowLayer::UpdateSession& other) -{ - fDirtyRegion = other.fDirtyRegion; - fInUse = other.fInUse; - fCause = other.fCause; - return *this; -} - Modified: haiku/trunk/src/servers/app/WindowLayer.h =================================================================== --- haiku/trunk/src/servers/app/WindowLayer.h 2008-01-06 20:09:55 UTC (rev 23271) +++ haiku/trunk/src/servers/app/WindowLayer.h 2008-01-06 20:20:37 UTC (rev 23272) @@ -320,8 +320,6 @@ inline bool IsRequest() const { return fCause & UPDATE_REQUEST; } - UpdateSession& operator=(const UpdateSession& other); - private: BRegion fDirtyRegion; bool fInUse; @@ -330,8 +328,9 @@ BRegion fDecoratorRegion; - UpdateSession fCurrentUpdateSession; - UpdateSession fPendingUpdateSession; + UpdateSession fUpdateSessions[2]; + UpdateSession* fCurrentUpdateSession; + UpdateSession* fPendingUpdateSession; // these two flags are supposed to ensure a sane // and consistent update session bool fUpdateRequested : 1; From marcusoverhagen at mail.berlios.de Mon Jan 7 13:48:21 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Mon, 7 Jan 2008 13:48:21 +0100 Subject: [Haiku-commits] r23273 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801071248.m07CmL3t024319@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-07 13:48:21 +0100 (Mon, 07 Jan 2008) New Revision: 23273 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23273&view=rev Added: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/ Log: copying current ide bus manager into ata directory Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide (from rev 23272, haiku/trunk/src/add-ons/kernel/bus_managers/ide) From marcusoverhagen at mail.berlios.de Mon Jan 7 13:56:59 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Mon, 7 Jan 2008 13:56:59 +0100 Subject: [Haiku-commits] r23274 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801071256.m07Cux2Y024924@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-07 13:56:59 +0100 (Mon, 07 Jan 2008) New Revision: 23274 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23274&view=rev Added: haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile haiku/trunk/src/add-ons/kernel/bus_managers/ata/KernelExport_ext.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/channels.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/dma.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/emulation.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_cmds.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_device_infoblock.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/pio.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/queuing.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/virtual_memory.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/wrapper.h Removed: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/ Log: Moved files again, this time to the correct dir. Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/Jamfile) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/KernelExport_ext.h (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/KernelExport_ext.h) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/ata.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/atapi.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/basic_protocol.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/channels.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/channels.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/devices.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/dma.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/dma.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/emulation.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/emulation.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/ide.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_cmds.h (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/ide_cmds.h) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_device_infoblock.h (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/ide_device_infoblock.h) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/ide_internal.h) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/ide_sim.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.h (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/ide_sim.h) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/pio.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/pio.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/queuing.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/queuing.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/scsi2ata.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/sync.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/virtual_memory.c (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/virtual_memory.c) Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata/wrapper.h (from rev 23273, haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide/wrapper.h) From marcusoverhagen at mail.berlios.de Mon Jan 7 13:59:04 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Mon, 7 Jan 2008 13:59:04 +0100 Subject: [Haiku-commits] r23275 - haiku/trunk/src/add-ons/kernel/bus_managers Message-ID: <200801071259.m07Cx43g025096@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-07 13:59:01 +0100 (Mon, 07 Jan 2008) New Revision: 23275 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23275&view=rev Removed: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ Log: From marcusoverhagen at mail.berlios.de Mon Jan 7 13:59:53 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Mon, 7 Jan 2008 13:59:53 +0100 Subject: [Haiku-commits] r23276 - haiku/trunk/src/add-ons/kernel/bus_managers Message-ID: <200801071259.m07Cxr2A025150@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-07 13:59:53 +0100 (Mon, 07 Jan 2008) New Revision: 23276 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23276&view=rev Added: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ Log: copying current ide bus manager into ata directory Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ata (from rev 23275, haiku/trunk/src/add-ons/kernel/bus_managers/ide) From jackburton at mail.berlios.de Mon Jan 7 14:43:30 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 7 Jan 2008 14:43:30 +0100 Subject: [Haiku-commits] r23277 - haiku/trunk/src/kits/interface Message-ID: <200801071343.m07DhUu9031845@sheep.berlios.de> Author: jackburton Date: 2008-01-07 14:43:29 +0100 (Mon, 07 Jan 2008) New Revision: 23277 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23277&view=rev Modified: haiku/trunk/src/kits/interface/MenuBar.cpp Log: Added comments which clarify why we are doing things like this. Modified: haiku/trunk/src/kits/interface/MenuBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuBar.cpp 2008-01-07 12:59:53 UTC (rev 23276) +++ haiku/trunk/src/kits/interface/MenuBar.cpp 2008-01-07 13:43:29 UTC (rev 23277) @@ -384,7 +384,9 @@ fPrevFocusToken = -1; fTracking = true; - + + // We are called from the window's thread, + // so let's call MenusBeginning() directly window->MenusBeginning(); fMenuSem = create_sem(0, "window close sem"); @@ -431,10 +433,7 @@ menuBar->fTracking = false; menuBar->fExtraRect = NULL; - // Sends a _MENUS_DONE_ message to the BWindow. - // Weird: There is a _MENUS_DONE_ message but not a - // _MENUS_BEGINNING_ message, in fact the MenusBeginning() - // hook function is called directly. + // We aren't the BWindow thread, so don't call MenusEnded() directly BWindow *window = menuBar->Window(); window->PostMessage(_MENUS_DONE_); From jackburton at mail.berlios.de Mon Jan 7 14:54:56 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 7 Jan 2008 14:54:56 +0100 Subject: [Haiku-commits] r23278 - haiku/trunk/src/kits/interface Message-ID: <200801071354.m07DsuoD001260@sheep.berlios.de> Author: jackburton Date: 2008-01-07 14:54:55 +0100 (Mon, 07 Jan 2008) New Revision: 23278 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23278&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp Log: Removed a check which was always false. Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-07 13:43:29 UTC (rev 23277) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-07 13:54:55 UTC (rev 23278) @@ -1413,10 +1413,8 @@ fState = MENU_STATE_TRACKING; UnlockLooper(); break; - } - else { - if (!_OverSubmenu(fSelected, screenLocation) - && system_time() > closeTime + kHysteresis + } else { + if (system_time() > closeTime + kHysteresis && fState != MENU_STATE_TRACKING_SUBMENU) { _SelectItem(NULL); fState = MENU_STATE_TRACKING; From jackburton at mail.berlios.de Mon Jan 7 16:46:28 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 7 Jan 2008 16:46:28 +0100 Subject: [Haiku-commits] r23279 - haiku/trunk/src/kits/interface Message-ID: <200801071546.m07FkSXc022372@sheep.berlios.de> Author: jackburton Date: 2008-01-07 16:46:28 +0100 (Mon, 07 Jan 2008) New Revision: 23279 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23279&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp Log: Some changes in menu tracking: - in the code path, now it's clear if the looper is locked or not - if menus are quitting, now we don't call snooze() anymore, and avoid the extra GetMouse() call. - some other cleanups Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-07 13:54:55 UTC (rev 23278) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-07 15:46:28 UTC (rev 23279) @@ -1374,32 +1374,34 @@ } bool releasedOnce = buttons == 0; - while (true) { + while (fState != MENU_STATE_CLOSED) { if (_CustomTrackingWantsToQuit()) break; - bool locked = LockLooper(); - if (!locked) + if (!LockLooper()) break; BMenuWindow *window = static_cast(Window()); - BPoint screenLocation = ConvertToScreen(location); if (window->CheckForScrolling(screenLocation)) { - item = NULL; - } else { - item = _HitTestItems(location, B_ORIGIN); - if (item != NULL) { - _UpdateStateOpenSelect(item, openTime, closeTime); - if (!releasedOnce) - releasedOnce = true; - } + UnlockLooper(); + continue; } + + item = _HitTestItems(location, B_ORIGIN); + if (item != NULL) { + _UpdateStateOpenSelect(item, openTime, closeTime); + if (!releasedOnce) + releasedOnce = true; + } // Track the submenu if (_OverSubmenu(fSelected, screenLocation)) { + // Since the submenu has its own looper, + // we can unlock ours. Doing so also make sure + // that our window gets any update message to + // redraw itself UnlockLooper(); - locked = false; int submenuAction = MENU_STATE_TRACKING; BMenu *submenu = fSelected->Submenu(); submenu->_SetStickyMode(_IsStickyMode()); @@ -1408,6 +1410,8 @@ item = submenuItem; fState = MENU_STATE_CLOSED; } + if (!LockLooper()) + break; } else if (item == NULL) { if (_OverSuper(screenLocation)) { fState = MENU_STATE_TRACKING; @@ -1423,39 +1427,35 @@ if (fSuper != NULL) { // Give supermenu the chance to continue tracking *action = fState; - if (locked) - UnlockLooper(); + UnlockLooper(); return NULL; } } } - if (!locked) - locked = LockLooper(); - - BPoint newLocation; - uint32 newButtons; - if (locked) { - GetMouse(&newLocation, &newButtons, true); - UnlockLooper(); - locked = false; - } + UnlockLooper(); - if (newLocation != location || newButtons != buttons) { - if (!releasedOnce && newButtons == 0 && buttons != 0) - releasedOnce = true; - location = newLocation; - buttons = newButtons; - } + if (fState != MENU_STATE_CLOSED) { + bigtime_t snoozeAmount = 50000; + snooze(snoozeAmount); + + BPoint newLocation; + uint32 newButtons; + if (LockLooper()) { + GetMouse(&newLocation, &newButtons, true); + UnlockLooper(); + } + + if (newLocation != location || newButtons != buttons) { + if (!releasedOnce && newButtons == 0 && buttons != 0) + releasedOnce = true; + location = newLocation; + buttons = newButtons; + } - if (releasedOnce) - _UpdateStateClose(item, location, buttons); - - if (fState == MENU_STATE_CLOSED) - break; - - bigtime_t snoozeAmount = 50000; - snooze(snoozeAmount); + if (releasedOnce) + _UpdateStateClose(item, location, buttons); + } } if (action != NULL) From jackburton at mail.berlios.de Mon Jan 7 17:13:14 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 7 Jan 2008 17:13:14 +0100 Subject: [Haiku-commits] r23280 - haiku/trunk/src/kits/interface Message-ID: <200801071613.m07GDEZv027495@sheep.berlios.de> Author: jackburton Date: 2008-01-07 17:13:14 +0100 (Mon, 07 Jan 2008) New Revision: 23280 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23280&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp haiku/trunk/src/kits/interface/MenuBar.cpp Log: Same thing as previous commit, only for BMenuBar. Added some other comment Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-07 15:46:28 UTC (rev 23279) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-07 16:13:14 UTC (rev 23280) @@ -1405,6 +1405,11 @@ int submenuAction = MENU_STATE_TRACKING; BMenu *submenu = fSelected->Submenu(); submenu->_SetStickyMode(_IsStickyMode()); + + // The following call blocks until the submenu + // gives control back to us, either because the mouse + // pointer goes out of the submenu's bounds, or because + // the user closes the menu BMenuItem *submenuItem = submenu->_Track(&submenuAction); if (submenuAction == MENU_STATE_CLOSED) { item = submenuItem; Modified: haiku/trunk/src/kits/interface/MenuBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuBar.cpp 2008-01-07 15:46:28 UTC (rev 23279) +++ haiku/trunk/src/kits/interface/MenuBar.cpp 2008-01-07 16:13:14 UTC (rev 23280) @@ -465,10 +465,9 @@ window->Unlock(); } - while (true) { + while (fState != MENU_STATE_CLOSED) { bigtime_t snoozeAmount = 40000; - bool locked = (Window() != NULL && window->Lock());//WithTimeout(200000) - if (!locked) + if (Window() == NULL || !window->Lock()) break; BMenuItem *menuItem = _HitTestItems(where, B_ORIGIN); @@ -504,7 +503,6 @@ // is over its window BMenu *menu = fSelected->Submenu(); window->Unlock(); - locked = false; snoozeAmount = 30000; bool wasSticky = _IsStickyMode(); menu->_SetStickyMode(wasSticky); @@ -535,35 +533,36 @@ } else fState = MENU_STATE_CLOSED; } + if (!window->Lock()) + break; } else if (menuItem == NULL && fSelected != NULL && !_IsStickyMode() && Bounds().Contains(where)) { _SelectItem(NULL); fState = MENU_STATE_TRACKING; } - if (!locked) - locked = window->Lock(); - - if (locked) { - GetMouse(&where, &buttons, true); - window->Unlock(); - locked = false; - } + window->Unlock(); + + if (fState != MENU_STATE_CLOSED) { + if (snoozeAmount > 0) + snooze(snoozeAmount); + + if (window->Lock()) { + GetMouse(&where, &buttons, true); + window->Unlock(); + } - if (fState == MENU_STATE_CLOSED - || (buttons != 0 && _IsStickyMode() && menuItem == NULL)) - break; - else if (buttons == 0 && !_IsStickyMode()) { - if ((fSelected != NULL && fSelected->Submenu() == NULL) - || menuItem == NULL) { - fChosenItem = fSelected; - break; - } else - _SetStickyMode(true); + if ((buttons != 0 && _IsStickyMode() && menuItem == NULL)) + fState = MENU_STATE_CLOSED; + else if (buttons == 0 && !_IsStickyMode()) { + if ((fSelected != NULL && fSelected->Submenu() == NULL) + || menuItem == NULL) { + fChosenItem = fSelected; + fState = MENU_STATE_CLOSED; + } else + _SetStickyMode(true); + } } - - if (snoozeAmount > 0) - snooze(snoozeAmount); } if (window->Lock()) { From marcusoverhagen at mail.berlios.de Mon Jan 7 20:29:15 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Mon, 7 Jan 2008 20:29:15 +0100 Subject: [Haiku-commits] r23281 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801071929.m07JTFcH008684@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-07 20:29:15 +0100 (Mon, 07 Jan 2008) New Revision: 23281 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23281&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/queuing.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c Log: modified device detection Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile 2008-01-07 16:13:14 UTC (rev 23280) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile 2008-01-07 19:29:15 UTC (rev 23281) @@ -1,4 +1,4 @@ -SubDir HAIKU_TOP src add-ons kernel bus_managers ide ; +SubDir HAIKU_TOP src add-ons kernel bus_managers ata ; UsePrivateHeaders drivers kernel ; UsePrivateHeaders [ FDirName kernel arch $(TARGET_ARCH) ] ; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-07 16:13:14 UTC (rev 23280) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-07 19:29:15 UTC (rev 23281) @@ -15,6 +15,7 @@ #include "ide_sim.h" #include "ide_cmds.h" +#define TRACE dprintf /** verify that device is ready for further PIO transmission */ @@ -785,3 +786,51 @@ enable_CQ(ide_device_info *device, bool enable) { } + + +status_t +ata_read_infoblock(ide_device_info *device, bool isAtapi) +{ + ide_bus_info *bus = device->bus; + int status; + + TRACE("ata_read_infoblock: device %p, isAtapi %d\n", device, isAtapi); + + // disable interrupts + bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3 | ide_devctrl_nien); + + device->tf_param_mask = 0; + device->tf.write.command = isAtapi ? IDE_CMD_IDENTIFY_PACKET_DEVICE : IDE_CMD_IDENTIFY_DEVICE; + + // initialize device selection flags, + // this is the only place where this bit gets initialized in the task file + if (bus->controller->read_command_block_regs(bus->channel_cookie, &device->tf, + ide_mask_device_head) != B_OK) { + TRACE("ata_read_infoblock: read_command_block_regs failed\n"); + return B_ERROR; + } + + device->tf.lba.device = device->is_device1; + + if (!send_command(device, NULL, isAtapi ? false : true, 20, ide_state_sync_waiting)) { + TRACE("ata_read_infoblock: send_command failed\n"); + return B_ERROR; + } + + if (ata_wait(bus, ide_status_drq, ide_status_bsy, true, 4000000) != B_OK) { + TRACE("ata_read_infoblock: wait failed\n"); + return B_ERROR; + } + + // get the infoblock + bus->controller->read_pio(bus->channel_cookie, (uint16 *)&device->infoblock, + sizeof(device->infoblock) / sizeof(uint16), false); + + if (!wait_for_drqdown(device)) { + TRACE("scan_device_int: wait_for_drqdown failed\n"); + return false; + } + + TRACE("ata_read_infoblock: success\n"); + return B_OK; +} Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-07 16:13:14 UTC (rev 23280) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-07 19:29:15 UTC (rev 23281) @@ -201,7 +201,7 @@ // TODO: the device will abort next command with a reset condition // perhaps we should hide that by reading sense? SHOW_FLOW0(3, "Reset"); - reset_device(device, qrequest); +// reset_device(device, qrequest); finish_checksense(qrequest); return; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c 2008-01-07 16:13:14 UTC (rev 23280) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c 2008-01-07 19:29:15 UTC (rev 23281) @@ -53,142 +53,83 @@ } -/** reset entire IDE bus - * all active request apart from are resubmitted - */ - -bool -reset_bus(ide_device_info *device, ide_qrequest *ignore) +status_t +reset_bus(ide_bus_info *bus, uint32 *sigDev0, uint32 *sigDev1) { - ide_bus_info *bus = device->bus; ide_controller_interface *controller = bus->controller; ide_channel_cookie channel = bus->channel_cookie; + ide_task_file tf; + status_t status; - dprintf("ide: reset_bus() device %p, bus %p\n", device, bus); + dprintf("ATA: reset_bus %p\n", bus); - FAST_LOG0(bus->log, ev_ide_reset_bus); + // disable interrupts and assert SRST for at least 5 usec + if (controller->write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien | ide_devctrl_srst) != B_OK) + goto error; + spin(20); - if (device->reconnect_timer_installed) { - cancel_timer(&device->reconnect_timer.te); - device->reconnect_timer_installed = false; - } + // clear SRST for at least 2 ms + if (controller->write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien) != B_OK) + goto error; + snooze(5000); - if (device->other_device->reconnect_timer_installed) { - cancel_timer(&device->other_device->reconnect_timer.te); - device->other_device->reconnect_timer_installed = false; - } + // wait up to 30 seconds for busy to clear, abort when error is set + status = ata_wait(bus, 0, ide_status_bsy, true, 33000000); + if (status != B_OK) + goto error; - // activate srst signal for 5 ?s - // also, deactivate IRQ - // (as usual, we will get an IRQ on disabling, but as we leave them - // disabled for 2 ms, this false report is ignored) - if (controller->write_device_control(channel, - ide_devctrl_nien | ide_devctrl_srst | ide_devctrl_bit3) != B_OK) - goto err0; + tf.chs.head = 0; + tf.chs.mode = ide_mode_lba; - spin(5); + // select device 0 + tf.chs.device = 0; + if (controller->write_command_block_regs(channel, &tf, ide_mask_device_head) != B_OK) + goto error; + status = ata_wait(bus, 0, ide_status_bsy | ide_status_drq, true, 50000); + if (status != B_OK) { + dprintf("ATA: reset_bus: device 0 not present\n"); + *sigDev0 = 0; + } else { + if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | + ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) + goto error; - if (controller->write_device_control(channel, ide_devctrl_nien | ide_devctrl_bit3) != B_OK) - goto err0; - - // let devices wake up - snooze(2000); - - // ouch, we have to wait up to 31 seconds! - if (!ide_wait(device, 0, ide_status_bsy, true, 31000000)) { - // as we don't know which of the devices is broken - // we leave them both alive - if (controller->write_device_control(channel, ide_devctrl_bit3) != B_OK) - goto err0; - - set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_LUN_TIMEOUT); - goto err1; + *sigDev0 = tf.lba.sector_count; + *sigDev0 |= ((uint32)tf.lba.lba_0_7) << 8; + *sigDev0 |= ((uint32)tf.lba.lba_8_15) << 16; + *sigDev0 |= ((uint32)tf.lba.lba_16_23) << 24; } - if (controller->write_device_control(channel, ide_devctrl_bit3) != B_OK) - goto err0; + // select device 1 + tf.chs.device = 1; + if (controller->write_command_block_regs(channel, &tf, ide_mask_device_head) != B_OK) + goto error; + status = ata_wait(bus, 0, ide_status_bsy | ide_status_drq, true, 50000); + if (status != B_OK) { + dprintf("ATA: reset_bus: device 1 not present\n"); + *sigDev1 = 0; + } else { + if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | + ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) + goto error; - finish_all_requests(bus->devices[0], ignore, SCSI_SCSI_BUS_RESET, true); - finish_all_requests(bus->devices[1], ignore, SCSI_SCSI_BUS_RESET, true); - - dprintf("ide: reset_bus() device %p, bus %p success\n", device, bus); - return true; - -err0: - set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_INTERNAL_FAILURE); - -err1: - finish_all_requests(bus->devices[0], ignore, SCSI_SCSI_BUS_RESET, true); - finish_all_requests(bus->devices[1], ignore, SCSI_SCSI_BUS_RESET, true); - - //xpt->call_async( bus->xpt_cookie, -1, -1, AC_BUS_RESET, NULL, 0 ); - - dprintf("ide: reset_bus() device %p, bus %p failed\n", device, bus); - return false; -} - - -/** execute packet device reset. - * resets entire bus on fail or if device is not atapi; - * all requests but are resubmitted - */ - -bool -reset_device(ide_device_info *device, ide_qrequest *ignore) -{ - ide_bus_info *bus = device->bus; - status_t res; - uint8 orig_command; - - dprintf("ide: reset_device() device %p\n", device); - - FAST_LOG1(bus->log, ev_ide_reset_device, device->is_device1); - SHOW_FLOW0(3, ""); - - if (!device->is_atapi) - goto err; - - if (device->reconnect_timer_installed) { - cancel_timer(&device->reconnect_timer.te); - device->reconnect_timer_installed = false; + *sigDev1 = tf.lba.sector_count; + *sigDev1 |= ((uint32)tf.lba.lba_0_7) << 8; + *sigDev1 |= ((uint32)tf.lba.lba_8_15) << 16; + *sigDev1 |= ((uint32)tf.lba.lba_16_23) << 24; } - // select device - if (bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, - ide_mask_device_head) != B_OK) - goto err; + dprintf("ATA: reset_bus success, device 0 signature: 0x%08lx, device 1 signature: 0x%08lx\n", *sigDev0, *sigDev1); - // safe original command to let caller restart it - orig_command = device->tf.write.command; + return B_OK; - // send device reset, independ of current device state - // (that's the point of a reset) - device->tf.write.command = IDE_CMD_DEVICE_RESET; - res = bus->controller->write_command_block_regs(bus->channel_cookie, - &device->tf, ide_mask_command); - device->tf.write.command = orig_command; +error: - if (res != B_OK) - goto err; - - // don't know how long to wait, but 31 seconds, like soft reset, - // should be enough - if (!ide_wait(device, 0, ide_status_bsy, true, 31000000)) - goto err; - - // alright, resubmit all requests - finish_all_requests(device, ignore, SCSI_SCSI_BUS_RESET, true); - - SHOW_FLOW0(3, "done"); - dprintf("ide: reset_device() device %p success\n", device); - return true; - -err: - // do the hard way - dprintf("ide: reset_device() device %p failed, calling reset_bus\n", device); - return reset_bus(device, ignore); + dprintf("ATA: reset_bus failed\n"); + return B_ERROR; } + /** new_state must be either accessing, async_waiting or sync_waiting * param_mask must not include command register */ @@ -250,12 +191,13 @@ return false; } +/* // reset device and retry if (reset_device(device, qrequest) && ++num_retries <= MAX_FAILED_SEND) { SHOW_FLOW0(1, "retrying"); goto retry; } - +*/ SHOW_FLOW0(1, "giving up"); // reset to often - abort request @@ -331,6 +273,39 @@ } +status_t +ata_wait(ide_bus_info *bus, uint8 mask, uint8 not_mask, + bool check_err, bigtime_t timeout) +{ + bigtime_t startTime = system_time(); + bigtime_t elapsedTime; + uint8 status; + + spin(1); // device needs 400ns to set status + + for (;;) { + + status = bus->controller->get_altstatus(bus->channel_cookie); + + if (check_err && (status & ide_status_err) != 0) + return B_ERROR; + + if ((status & mask) == mask && (status & not_mask) == 0) + return B_OK; + + elapsedTime = system_time() - startTime; + + if (elapsedTime > timeout) + return B_TIMED_OUT; + + if (elapsedTime < 5000) + spin(1); + else + snooze(5000); + } +} + + /** busy-wait for device * mask - bits of status register that must be set * not_mask - bits of status register that must not be set Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-07 16:13:14 UTC (rev 23280) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-07 19:29:15 UTC (rev 23281) @@ -49,7 +49,7 @@ /** destroy device info */ -static void +void destroy_device(ide_device_info *device) { TRACE("destroy_device: device %p\n", device); @@ -101,7 +101,7 @@ /** create device info */ -static ide_device_info * +ide_device_info * create_device(ide_bus_info *bus, bool is_device1) { ide_device_info *device; @@ -185,7 +185,7 @@ /** read info block of ATA or ATAPI device */ - +/* static bool scan_device_int(ide_device_info *device, bool atapi) { @@ -284,10 +284,24 @@ prep_infoblock(device); return true; } +*/ - /** scan one device */ +status_t +scan_device(ide_device_info *device, bool isAtapi) +{ + dprintf("ATA: scan_device\n"); + if (ata_read_infoblock(device, isAtapi) != B_OK) { + dprintf("ATA: couldn't read infoblock for device %p\n", device); + return B_ERROR; + } + + prep_infoblock(device); + return B_OK; +} + +/* void scan_device_worker(ide_bus_info *bus, void *arg) { @@ -321,12 +335,11 @@ goto err; bus->state = ide_state_idle; - release_sem(bus->scan_device_sem); return; err: destroy_device(device); bus->state = ide_state_idle; - release_sem(bus->scan_device_sem); } +*/ \ No newline at end of file Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-07 16:13:14 UTC (rev 23280) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-07 19:29:15 UTC (rev 23281) @@ -221,9 +221,6 @@ ide_device_info *devices[2]; ide_device_info *first_device; - ide_synced_pc scan_bus_syncinfo; // used to start bus scan - sem_id scan_device_sem; // released when device has been scanned - ide_synced_pc disconnect_syncinfo; // used to handle lost controller uchar path_id; @@ -331,7 +328,9 @@ void ata_exec_io(ide_device_info *device, ide_qrequest *qrequest); +status_t ata_read_infoblock(ide_device_info *device, bool isAtapi); + // atapi.c bool prep_atapi(ide_device_info *device); @@ -343,6 +342,9 @@ // basic_prot.c +status_t ata_wait(ide_bus_info *bus, uint8 mask, uint8 not_mask, bool check_err, bigtime_t timeout); + + bool ide_wait(ide_device_info *device, int mask, int not_mask, bool check_err, bigtime_t timeout); bool wait_for_drq(ide_device_info *device); @@ -353,12 +355,14 @@ bool send_command(ide_device_info *device, ide_qrequest *qrequest, bool need_drdy, uint32 timeout, ide_bus_state new_state); bool device_start_service( ide_device_info *device, int *tag); -bool reset_device(ide_device_info *device, ide_qrequest *ignore); -bool reset_bus(ide_device_info *device, ide_qrequest *ignore); +//bool reset_device(ide_device_info *device, ide_qrequest *ignore); +//bool reset_bus(ide_device_info *device, ide_qrequest *ignore); bool check_service_req(ide_device_info *device); +status_t reset_bus(ide_bus_info *bus, uint32 *sigDev0, uint32 *sigDev1); + // channel_mgr.c extern ide_for_controller_interface ide_for_controller_module; @@ -366,9 +370,12 @@ // device_mgr.c -void scan_device_worker(ide_bus_info *bus, void *arg); +status_t scan_device(ide_device_info *device, bool isAtapi); +void destroy_device(ide_device_info *device); +ide_device_info *create_device(ide_bus_info *bus, bool is_device1); + // dma.c bool prepare_dma(ide_device_info *device, ide_qrequest *qrequest); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-07 16:13:14 UTC (rev 23280) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-07 19:29:15 UTC (rev 23281) @@ -79,20 +79,7 @@ static inline bool is_queuable(ide_device_info *device, scsi_ccb *request) { - int opcode = request->cdb[0]; - - // XXX disable queuing - if (!device->CQ_enabled) - return false; - - // make sure the caller allows queuing - if ((request->flags & SCSI_ORDERED_QTAG) != 0) - return false; - - // for atapi, all commands could be queued, but all - // atapi devices I know don't support queuing anyway - return opcode == SCSI_OP_READ_6 || opcode == SCSI_OP_WRITE_6 - || opcode == SCSI_OP_READ_10 || opcode == SCSI_OP_WRITE_10; + return false; } @@ -241,35 +228,39 @@ } -static void -scan_device(ide_bus_info *bus, int device) -{ - SHOW_FLOW0(4, ""); - - // currently, the SCSI bus manager doesn't block the - // bus when a bus or device scan is issued, so we - // have to use a SPC for that to be sure no one else - // is accessing the device or bus concurrently - schedule_synced_pc(bus, &bus->scan_bus_syncinfo, (void *)device); - - acquire_sem(bus->scan_device_sem); -} - - static uchar sim_scan_bus(ide_bus_info *bus) { + uint32 deviceSignature[2]; + ide_device_info *device; + status_t status; + bool isAtapi; int i; - SHOW_FLOW0(4, ""); + dprintf("ATA: sim_scan_bus: bus %p\n", bus); if (bus->disconnected) return SCSI_NO_HBA; +// IDE_LOCK(bus); + + status = reset_bus(bus, &deviceSignature[0], &deviceSignature[1]); + for (i = 0; i < bus->max_devices; ++i) { - scan_device(bus, i); + if (bus->devices[i]) + destroy_device(bus->devices[i]); + + if (status == B_OK && deviceSignature[i] != 0) { + isAtapi = deviceSignature[i] == 0xeb140101; + device = create_device(bus, i /* isDevice1 */); + if (scan_device(device, isAtapi) != B_OK) + destroy_device(device); + } } +// IDE_UNLOCK(bus); + dprintf("ATA: sim_scan_bus: bus %p finished\n", bus); + return SCSI_REQ_CMP; } @@ -581,7 +572,6 @@ } #endif - init_synced_pc(&bus->scan_bus_syncinfo, scan_device_worker); init_synced_pc(&bus->disconnect_syncinfo, disconnect_worker); bus->scsi_cookie = user_cookie; @@ -601,12 +591,6 @@ bus->devices[0] = bus->devices[1] = NULL; - bus->scan_device_sem = create_sem(0, "ide_scan_finished"); - if (bus->scan_device_sem < 0) { - status = bus->scan_device_sem; - goto err3; - } - status = INIT_BEN(&bus->status_report_ben, "ide_status_report"); if (status < B_OK) goto err4; @@ -675,13 +659,11 @@ err5: DELETE_BEN(&bus->status_report_ben); err4: - delete_sem(bus->scan_device_sem); err3: delete_sem(bus->sync_wait_sem); err2: scsi->free_dpc(bus->irq_dpc); err1: - uninit_synced_pc(&bus->scan_bus_syncinfo); uninit_synced_pc(&bus->disconnect_syncinfo); #ifdef USE_FAST_LOG fast_log->stop_log(bus->log); @@ -702,10 +684,8 @@ pnp->put_device_node(parent); DELETE_BEN(&bus->status_report_ben); - delete_sem(bus->scan_device_sem); delete_sem(bus->sync_wait_sem); scsi->free_dpc(bus->irq_dpc); - uninit_synced_pc(&bus->scan_bus_syncinfo); uninit_synced_pc(&bus->disconnect_syncinfo); // fast_log->stop_log(bus->log); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/queuing.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/queuing.c 2008-01-07 16:13:14 UTC (rev 23280) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/queuing.c 2008-01-07 19:29:15 UTC (rev 23281) @@ -370,5 +370,6 @@ err: // ouch! device didn't react - we have to reset it - return reset_device(device, NULL); + //return reset_device(device, NULL); + return false; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c 2008-01-07 16:13:14 UTC (rev 23280) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c 2008-01-07 19:29:15 UTC (rev 23281) @@ -263,7 +263,7 @@ FAST_LOG1(bus->log, ev_ide_timeout_dpc, (uint32)qrequest); // this also resets overlapped commands - reset_device(device, qrequest); +// reset_device(device, qrequest); device->subsys_status = SCSI_CMD_TIMEOUT; From jackburton at mail.berlios.de Mon Jan 7 23:21:26 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 7 Jan 2008 23:21:26 +0100 Subject: [Haiku-commits] r23282 - haiku/trunk/src/kits/interface Message-ID: <200801072221.m07MLQhQ023865@sheep.berlios.de> Author: jackburton Date: 2008-01-07 23:21:25 +0100 (Mon, 07 Jan 2008) New Revision: 23282 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23282&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp haiku/trunk/src/kits/interface/MenuBar.cpp Log: Improved the code still a little bit. Menus seems to be somewhat more responsive. Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-07 19:29:15 UTC (rev 23281) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-07 22:21:25 UTC (rev 23282) @@ -67,6 +67,7 @@ } }; + } // namespace BPrivate @@ -1230,7 +1231,7 @@ SetFont(&font, B_FONT_FAMILY_AND_STYLE | B_FONT_SIZE); fLayoutData = new LayoutData; - + SetLowColor(sMenuInfo.background_color); SetViewColor(sMenuInfo.background_color); @@ -1372,7 +1373,7 @@ GetMouse(&location, &buttons); UnlockLooper(); } - + bool releasedOnce = buttons == 0; while (fState != MENU_STATE_CLOSED) { if (_CustomTrackingWantsToQuit()) @@ -1392,11 +1393,9 @@ if (item != NULL) { _UpdateStateOpenSelect(item, openTime, closeTime); if (!releasedOnce) - releasedOnce = true; - } - - // Track the submenu - if (_OverSubmenu(fSelected, screenLocation)) { + releasedOnce = true; + + } else if (_OverSubmenu(fSelected, screenLocation)) { // Since the submenu has its own looper, // we can unlock ours. Doing so also make sure // that our window gets any update message to @@ -1417,24 +1416,24 @@ } if (!LockLooper()) break; - } else if (item == NULL) { - if (_OverSuper(screenLocation)) { + } else if (_OverSuper(screenLocation)) { + fState = MENU_STATE_TRACKING; + UnlockLooper(); + break; + } else { + // Mouse pointer outside menu + + if (system_time() > closeTime + kHysteresis + && fState != MENU_STATE_TRACKING_SUBMENU) { + _SelectItem(NULL); fState = MENU_STATE_TRACKING; - UnlockLooper(); - break; - } else { - if (system_time() > closeTime + kHysteresis - && fState != MENU_STATE_TRACKING_SUBMENU) { - _SelectItem(NULL); - fState = MENU_STATE_TRACKING; - } + } - if (fSuper != NULL) { - // Give supermenu the chance to continue tracking - *action = fState; - UnlockLooper(); - return NULL; - } + if (fSuper != NULL) { + // Give supermenu the chance to continue tracking + *action = fState; + UnlockLooper(); + return NULL; } } Modified: haiku/trunk/src/kits/interface/MenuBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuBar.cpp 2008-01-07 19:29:15 UTC (rev 23281) +++ haiku/trunk/src/kits/interface/MenuBar.cpp 2008-01-07 22:21:25 UTC (rev 23282) @@ -496,9 +496,7 @@ _SelectItem(menuItem); } } - } - - if (_OverSubmenu(fSelected, ConvertToScreen(where))) { + } else if (_OverSubmenu(fSelected, ConvertToScreen(where))) { // call _Track() from the selected sub-menu when the mouse cursor // is over its window BMenu *menu = fSelected->Submenu(); From jackburton at mail.berlios.de Mon Jan 7 23:42:28 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 7 Jan 2008 23:42:28 +0100 Subject: [Haiku-commits] r23283 - haiku/trunk/src/kits/interface Message-ID: <200801072242.m07MgSFH025807@sheep.berlios.de> Author: jackburton Date: 2008-01-07 23:42:28 +0100 (Mon, 07 Jan 2008) New Revision: 23283 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23283&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp Log: Sorry, this wasn't meant to be here. Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-07 22:21:25 UTC (rev 23282) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-07 22:42:28 UTC (rev 23283) @@ -1924,19 +1924,6 @@ } -int -BMenu::State(BMenuItem **item) const -{ - if (fState == MENU_STATE_TRACKING || fState == MENU_STATE_CLOSED) - return fState; - - if (fSelected != NULL && fSelected->Submenu() != NULL) - return fSelected->Submenu()->State(item); - - return fState; -} - - void BMenu::InvokeItem(BMenuItem *item, bool now) { From jackburton at mail.berlios.de Mon Jan 7 23:55:36 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 7 Jan 2008 23:55:36 +0100 Subject: [Haiku-commits] r23284 - haiku/trunk/src/kits/interface Message-ID: <200801072255.m07Mta90026749@sheep.berlios.de> Author: jackburton Date: 2008-01-07 23:55:36 +0100 (Mon, 07 Jan 2008) New Revision: 23284 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23284&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp Log: Double sorry... Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-07 22:42:28 UTC (rev 23283) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-07 22:55:36 UTC (rev 23284) @@ -1924,6 +1924,19 @@ } +int +BMenu::State(BMenuItem **item) const +{ + if (fState == MENU_STATE_TRACKING || fState == MENU_STATE_CLOSED) + return fState; + + if (fSelected != NULL && fSelected->Submenu() != NULL) + return fSelected->Submenu()->State(item); + + return fState; +} + + void BMenu::InvokeItem(BMenuItem *item, bool now) { From stippi at mail.berlios.de Tue Jan 8 17:39:00 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 8 Jan 2008 17:39:00 +0100 Subject: [Haiku-commits] r23285 - haiku/trunk/src/kits/interface Message-ID: <200801081639.m08Gd0EW030621@sheep.berlios.de> Author: stippi Date: 2008-01-08 17:39:00 +0100 (Tue, 08 Jan 2008) New Revision: 23285 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23285&view=rev Modified: haiku/trunk/src/kits/interface/Slider.cpp Log: * fix keyboard handling to trigger the correct invokation message * add support for B_HOME and B_END key (jump to min/max value) Modified: haiku/trunk/src/kits/interface/Slider.cpp =================================================================== --- haiku/trunk/src/kits/interface/Slider.cpp 2008-01-07 22:55:36 UTC (rev 23284) +++ haiku/trunk/src/kits/interface/Slider.cpp 2008-01-08 16:39:00 UTC (rev 23285) @@ -404,28 +404,34 @@ if (!IsEnabled() || IsHidden()) return; + int32 newValue = Value(); + switch (bytes[0]) { case B_LEFT_ARROW: case B_DOWN_ARROW: { - int32 oldValue = Value(); - - SetValue(Value() - KeyIncrementValue()); - if (oldValue != Value()) - Invoke(); + newValue -= KeyIncrementValue(); break; } case B_RIGHT_ARROW: case B_UP_ARROW: { - int32 oldValue = Value(); - - SetValue(Value() + KeyIncrementValue()); - if (oldValue != Value()) - Invoke(); + newValue += KeyIncrementValue(); break; } + case B_HOME: + newValue = fMinValue; + break; + case B_END: + newValue = fMaxValue; + break; default: BControl::KeyDown(bytes, numBytes); + return; } + + if (newValue != Value()) { + SetValue(newValue); + InvokeNotify(ModificationMessage(), B_CONTROL_MODIFIED); + } } From stippi at mail.berlios.de Tue Jan 8 19:56:04 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 8 Jan 2008 19:56:04 +0100 Subject: [Haiku-commits] r23286 - haiku/trunk/src/kits/interface Message-ID: <200801081856.m08Iu4oM001375@sheep.berlios.de> Author: stippi Date: 2008-01-08 19:56:04 +0100 (Tue, 08 Jan 2008) New Revision: 23286 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23286&view=rev Modified: haiku/trunk/src/kits/interface/Slider.cpp Log: * fix some invalidation problems with the triangle thumb which are caused by non-traight lines extending past the thumb frame because of anti-aliasing effects Modified: haiku/trunk/src/kits/interface/Slider.cpp =================================================================== --- haiku/trunk/src/kits/interface/Slider.cpp 2008-01-08 16:39:00 UTC (rev 23285) +++ haiku/trunk/src/kits/interface/Slider.cpp 2008-01-08 18:56:04 UTC (rev 23286) @@ -615,15 +615,6 @@ BRect oldThumbFrame = ThumbFrame(); - if (IsFocus() && Style() == B_TRIANGLE_THUMB) { - // we need to update the region with the focus mark as well - // (a method BSlider::FocusMarkFrame() would be nice as well) - if (fOrientation == B_HORIZONTAL) - oldThumbFrame.bottom += 2; - else - oldThumbFrame.left -= 2; - } - // While it would be enough to do this dependent on fUseFillColor, // that doesn't work out if DrawBar() has been overridden by a sub class if (fOrientation == B_HORIZONTAL) @@ -634,8 +625,26 @@ _SetLocation(loc); BControl::SetValueNoUpdate(value); - Invalidate(oldThumbFrame | ThumbFrame()); + BRect invalid = oldThumbFrame | ThumbFrame(); + if (Style() == B_TRIANGLE_THUMB) { + // 1) we need to take care of pixels touched because of + // anti-aliasing + // 2) we need to update the region with the focus mark as well + // (a method BSlider::FocusMarkFrame() would be nice as well) + if (fOrientation == B_HORIZONTAL) { + if (IsFocus()) + invalid.bottom += 2; + invalid.InsetBy(-1, 0); + } else { + if (IsFocus()) + invalid.left -= 2; + invalid.InsetBy(0, -1); + } + } + + Invalidate(invalid); + // update text label float oldWidth = 0.0f, width = 0.0f; From mmu_man at mail.berlios.de Tue Jan 8 20:58:51 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 8 Jan 2008 20:58:51 +0100 Subject: [Haiku-commits] r23287 - haiku/trunk/data/artwork/icons Message-ID: <200801081958.m08JwpbK016425@sheep.berlios.de> Author: mmu_man Date: 2008-01-08 20:58:50 +0100 (Tue, 08 Jan 2008) New Revision: 23287 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23287&view=rev Modified: haiku/trunk/data/artwork/icons/File_GoogleFS Log: Seems I forgot to commit the overlay on that one. Modified: haiku/trunk/data/artwork/icons/File_GoogleFS =================================================================== (Binary files differ) From marcusoverhagen at mail.berlios.de Tue Jan 8 22:46:31 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Tue, 8 Jan 2008 22:46:31 +0100 Subject: [Haiku-commits] r23288 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801082146.m08LkVlR027804@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-08 22:46:30 +0100 (Tue, 08 Jan 2008) New Revision: 23288 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23288&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c Log: Modified device reset and detection, still broken Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-08 19:58:50 UTC (rev 23287) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-08 21:46:30 UTC (rev 23288) @@ -17,6 +17,36 @@ #define TRACE dprintf +void +ata_select_device(ide_bus_info *bus, int device) +{ + ide_task_file tf; + tf.chs.head = 0; + tf.chs.mode = ide_mode_lba; + tf.chs.device = device ? 1 : 0; + + bus->controller->read_command_block_regs(bus->channel_cookie, &tf, ide_mask_device_head); + spin(1); // wait 400 nsec +} + + +/* + +void +ata_select_device(ide_device_info *device) +{ + ide_task_file tf; + tf.chs.head = 0; + tf.chs.mode = ide_mode_lba; + tf.chs.device = device->is_device1; + + device->bus->controller->read_command_block_regs(device->bus->channel_cookie, &tf, + ide_mask_device_head); + spin(1); // wait 400 nsec +} +*/ + + /** verify that device is ready for further PIO transmission */ static bool Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c 2008-01-08 19:58:50 UTC (rev 23287) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c 2008-01-08 21:46:30 UTC (rev 23288) @@ -63,62 +63,66 @@ dprintf("ATA: reset_bus %p\n", bus); + // disable interrupts and assert SRST for at least 5 usec if (controller->write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien | ide_devctrl_srst) != B_OK) goto error; spin(20); - // clear SRST for at least 2 ms + // clear SRST and wait for at least 2 ms but (we wait 150ms like everyone else does) if (controller->write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien) != B_OK) goto error; - snooze(5000); + snooze(150000); - // wait up to 30 seconds for busy to clear, abort when error is set - status = ata_wait(bus, 0, ide_status_bsy, true, 33000000); - if (status != B_OK) - goto error; + ata_select_device(bus, 0); - tf.chs.head = 0; - tf.chs.mode = ide_mode_lba; + dprintf("altstatus device 0: %x\n", controller->get_altstatus(channel)); - // select device 0 - tf.chs.device = 0; - if (controller->write_command_block_regs(channel, &tf, ide_mask_device_head) != B_OK) + // wait up to 31 seconds for busy to clear, abort when error is set + status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); + if (status != B_OK) { + if (status == B_TIMED_OUT) + dprintf("ATA: reset_bus: timeout\n"); + else + dprintf("ATA: reset_bus: error bit set\n"); goto error; - status = ata_wait(bus, 0, ide_status_bsy | ide_status_drq, true, 50000); - if (status != B_OK) { - dprintf("ATA: reset_bus: device 0 not present\n"); - *sigDev0 = 0; - } else { - if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | - ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) - goto error; - - *sigDev0 = tf.lba.sector_count; - *sigDev0 |= ((uint32)tf.lba.lba_0_7) << 8; - *sigDev0 |= ((uint32)tf.lba.lba_8_15) << 16; - *sigDev0 |= ((uint32)tf.lba.lba_16_23) << 24; } - // select device 1 - tf.chs.device = 1; - if (controller->write_command_block_regs(channel, &tf, ide_mask_device_head) != B_OK) + if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | + ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) goto error; - status = ata_wait(bus, 0, ide_status_bsy | ide_status_drq, true, 50000); + + *sigDev0 = tf.lba.sector_count; + *sigDev0 |= ((uint32)tf.lba.lba_0_7) << 8; + *sigDev0 |= ((uint32)tf.lba.lba_8_15) << 16; + *sigDev0 |= ((uint32)tf.lba.lba_16_23) << 24; + + + + ata_select_device(bus, 1); + + dprintf("altstatus device 1: %x\n", controller->get_altstatus(channel)); + + // wait up to 31 seconds for busy to clear, abort when error is set + status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); if (status != B_OK) { - dprintf("ATA: reset_bus: device 1 not present\n"); - *sigDev1 = 0; - } else { - if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | - ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) - goto error; - - *sigDev1 = tf.lba.sector_count; - *sigDev1 |= ((uint32)tf.lba.lba_0_7) << 8; - *sigDev1 |= ((uint32)tf.lba.lba_8_15) << 16; - *sigDev1 |= ((uint32)tf.lba.lba_16_23) << 24; + if (status == B_TIMED_OUT) + dprintf("ATA: reset_bus: timeout\n"); + else + dprintf("ATA: reset_bus: error bit set\n"); + goto error; } + if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | + ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) + goto error; + + *sigDev1 = tf.lba.sector_count; + *sigDev1 |= ((uint32)tf.lba.lba_0_7) << 8; + *sigDev1 |= ((uint32)tf.lba.lba_8_15) << 16; + *sigDev1 |= ((uint32)tf.lba.lba_16_23) << 24; + + dprintf("ATA: reset_bus success, device 0 signature: 0x%08lx, device 1 signature: 0x%08lx\n", *sigDev0, *sigDev1); return B_OK; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-08 19:58:50 UTC (rev 23287) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-08 21:46:30 UTC (rev 23288) @@ -315,6 +315,9 @@ // ata.c +//void ata_select_device(ide_device_info *device); +void ata_select_device(ide_bus_info *bus, int device); + bool check_rw_error(ide_device_info *device, ide_qrequest *qrequest); bool check_output(ide_device_info *device, bool drdy_required, int error_mask, bool is_write); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-08 19:58:50 UTC (rev 23287) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-08 21:46:30 UTC (rev 23288) @@ -264,7 +264,14 @@ return SCSI_REQ_CMP; } +static uchar +sim_not_scan_bus(ide_bus_info *bus) +{ + dprintf("ATA: sim_not_scan_bus\n"); + return SCSI_REQ_CMP; +} + static uchar sim_abort(ide_bus_info *bus, scsi_ccb *ccb_to_abort) { @@ -843,7 +850,7 @@ (uchar (*)(scsi_sim_cookie, scsi_ccb *)) sim_term_io, (uchar (*)(scsi_sim_cookie, scsi_path_inquiry *))sim_path_inquiry, - (uchar (*)(scsi_sim_cookie)) sim_scan_bus, + (uchar (*)(scsi_sim_cookie)) sim_not_scan_bus, (uchar (*)(scsi_sim_cookie)) sim_reset_bus, (void (*)(scsi_sim_cookie, uchar, From marcusoverhagen at mail.berlios.de Tue Jan 8 23:31:36 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Tue, 8 Jan 2008 23:31:36 +0100 Subject: [Haiku-commits] r23289 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801082231.m08MVaGh004067@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-08 23:31:35 +0100 (Tue, 08 Jan 2008) New Revision: 23289 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23289&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c Log: check for device presence before trying to read the signature Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-08 21:46:30 UTC (rev 23288) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-08 22:31:35 UTC (rev 23289) @@ -25,11 +25,32 @@ tf.chs.mode = ide_mode_lba; tf.chs.device = device ? 1 : 0; - bus->controller->read_command_block_regs(bus->channel_cookie, &tf, ide_mask_device_head); + bus->controller->write_command_block_regs(bus->channel_cookie, &tf, ide_mask_device_head); spin(1); // wait 400 nsec } +bool +ata_is_device_present(ide_bus_info *bus, int device) +{ + ide_task_file tf; + + ata_select_device(bus, device); + + tf.lba.sector_count = 0xaa; + tf.lba.lba_0_7 = 0x55; + + bus->controller->write_command_block_regs(bus->channel_cookie, &tf, + ide_mask_sector_count | ide_mask_LBA_low); + spin(1); // wait 400 nsec + + bus->controller->read_command_block_regs(bus->channel_cookie, &tf, + ide_mask_sector_count | ide_mask_LBA_low); + + return tf.lba.sector_count == 0xaa && tf.lba.lba_0_7 == 0x55; +} + + /* void Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c 2008-01-08 21:46:30 UTC (rev 23288) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c 2008-01-08 22:31:35 UTC (rev 23289) @@ -60,10 +60,17 @@ ide_channel_cookie channel = bus->channel_cookie; ide_task_file tf; status_t status; + bool devicePresent0; + bool devicePresent1; dprintf("ATA: reset_bus %p\n", bus); + devicePresent0 = ata_is_device_present(bus, 0); + devicePresent1 = ata_is_device_present(bus, 1); + dprintf("ATA: reset_bus: ata_is_device_present device 0, present %d\n", devicePresent0); + dprintf("ATA: reset_bus: ata_is_device_present device 1, present %d\n", devicePresent1); + // disable interrupts and assert SRST for at least 5 usec if (controller->write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien | ide_devctrl_srst) != B_OK) goto error; @@ -74,55 +81,60 @@ goto error; snooze(150000); - ata_select_device(bus, 0); + if (devicePresent0) { - dprintf("altstatus device 0: %x\n", controller->get_altstatus(channel)); + ata_select_device(bus, 0); + dprintf("altstatus device 0: %x\n", controller->get_altstatus(channel)); - // wait up to 31 seconds for busy to clear, abort when error is set - status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); - if (status != B_OK) { - if (status == B_TIMED_OUT) - dprintf("ATA: reset_bus: timeout\n"); - else - dprintf("ATA: reset_bus: error bit set\n"); - goto error; - } + // wait up to 31 seconds for busy to clear, abort when error is set + status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); + if (status != B_OK) { + if (status == B_TIMED_OUT) + dprintf("ATA: reset_bus: timeout\n"); + else + dprintf("ATA: reset_bus: error bit set\n"); + goto error; + } - if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | - ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) - goto error; + if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | + ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) + goto error; - *sigDev0 = tf.lba.sector_count; - *sigDev0 |= ((uint32)tf.lba.lba_0_7) << 8; - *sigDev0 |= ((uint32)tf.lba.lba_8_15) << 16; - *sigDev0 |= ((uint32)tf.lba.lba_16_23) << 24; + *sigDev0 = tf.lba.sector_count; + *sigDev0 |= ((uint32)tf.lba.lba_0_7) << 8; + *sigDev0 |= ((uint32)tf.lba.lba_8_15) << 16; + *sigDev0 |= ((uint32)tf.lba.lba_16_23) << 24; + } else { + *sigDev0 = 0; + } + if (devicePresent1) { + + ata_select_device(bus, 1); + dprintf("altstatus device 1: %x\n", controller->get_altstatus(channel)); + // wait up to 31 seconds for busy to clear, abort when error is set + status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); + if (status != B_OK) { + if (status == B_TIMED_OUT) + dprintf("ATA: reset_bus: timeout\n"); + else + dprintf("ATA: reset_bus: error bit set\n"); + goto error; + } - ata_select_device(bus, 1); + if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | + ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) + goto error; - dprintf("altstatus device 1: %x\n", controller->get_altstatus(channel)); - - // wait up to 31 seconds for busy to clear, abort when error is set - status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); - if (status != B_OK) { - if (status == B_TIMED_OUT) - dprintf("ATA: reset_bus: timeout\n"); - else - dprintf("ATA: reset_bus: error bit set\n"); - goto error; + *sigDev1 = tf.lba.sector_count; + *sigDev1 |= ((uint32)tf.lba.lba_0_7) << 8; + *sigDev1 |= ((uint32)tf.lba.lba_8_15) << 16; + *sigDev1 |= ((uint32)tf.lba.lba_16_23) << 24; + } else { + *sigDev1 = 0; } - if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | - ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) - goto error; - - *sigDev1 = tf.lba.sector_count; - *sigDev1 |= ((uint32)tf.lba.lba_0_7) << 8; - *sigDev1 |= ((uint32)tf.lba.lba_8_15) << 16; - *sigDev1 |= ((uint32)tf.lba.lba_16_23) << 24; - - dprintf("ATA: reset_bus success, device 0 signature: 0x%08lx, device 1 signature: 0x%08lx\n", *sigDev0, *sigDev1); return B_OK; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-08 21:46:30 UTC (rev 23288) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-08 22:31:35 UTC (rev 23289) @@ -317,7 +317,9 @@ //void ata_select_device(ide_device_info *device); void ata_select_device(ide_bus_info *bus, int device); +bool ata_is_device_present(ide_bus_info *bus, int device); + bool check_rw_error(ide_device_info *device, ide_qrequest *qrequest); bool check_output(ide_device_info *device, bool drdy_required, int error_mask, bool is_write); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-08 21:46:30 UTC (rev 23288) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-08 22:31:35 UTC (rev 23289) @@ -659,6 +659,13 @@ *cookie = bus; +/* + // make sure LBA bit is set + bus->controller->read_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_device_head); + tf.chs.mode = ide_mode_lba; + bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_device_head); +*/ + // detect devices sim_scan_bus(bus); return B_OK; From stippi at mail.berlios.de Tue Jan 8 23:35:46 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 8 Jan 2008 23:35:46 +0100 Subject: [Haiku-commits] r23290 - haiku/trunk/src/preferences/drivesetup Message-ID: <200801082235.m08MZkJ5007104@sheep.berlios.de> Author: stippi Date: 2008-01-08 23:35:45 +0100 (Tue, 08 Jan 2008) New Revision: 23290 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23290&view=rev Modified: haiku/trunk/src/preferences/drivesetup/DiskView.cpp haiku/trunk/src/preferences/drivesetup/MainWindow.cpp haiku/trunk/src/preferences/drivesetup/PartitionList.cpp Log: * the DiskView is now displaying the partition layout grafically and draws a frame around the currently selected partition (in the listview) Modified: haiku/trunk/src/preferences/drivesetup/DiskView.cpp =================================================================== --- haiku/trunk/src/preferences/drivesetup/DiskView.cpp 2008-01-08 22:31:35 UTC (rev 23289) +++ haiku/trunk/src/preferences/drivesetup/DiskView.cpp 2008-01-08 22:35:45 UTC (rev 23290) @@ -7,6 +7,7 @@ */ #include "DiskView.h" +#include #include #include @@ -61,17 +62,18 @@ class PartitionDrawer : public BDiskDeviceVisitor { public: - PartitionDrawer(BView* view) + PartitionDrawer(BView* view, partition_id selectedPartition) : fView(view) , fBoxMap() , fColorIndex(0) + , fSelectedPartition(selectedPartition) { } virtual bool Visit(BDiskDevice* device) { fBoxMap.Put(device->ID(), PartitionBox(fView->Bounds(), _NextColor())); - return true; + return false; } virtual bool Visit(BPartition* partition, int32 level) @@ -81,12 +83,47 @@ PartitionBox parent = fBoxMap.Get(partition->Parent()->ID()); BRect frame = parent.frame; - // TODO .... calculate frame within parent frame (inset...) + // calculate frame within parent frame + off_t offset = partition->Offset(); + off_t size = partition->Size(); + off_t parentOffset = partition->Parent()->Offset(); + off_t parentSize = partition->Parent()->Size(); + float width = frame.Width() * size / parentSize; + frame.left = roundf(frame.left + frame.Width() + * (offset - parentOffset) / parentSize); + frame.right = frame.left + width; - fBoxMap.Put(partition->ID(), PartitionBox(frame, _NextColor())); - return true; + frame.InsetBy(4, 4); + if (frame.right < frame.left) + frame.right = frame.left; + + rgb_color color = _NextColor(); + fBoxMap.Put(partition->ID(), PartitionBox(frame, color)); + + return false; } + void Draw(BView* view) + { + PartitionBoxMap::Iterator iterator = fBoxMap.GetIterator(); + while (iterator.HasNext()) { + PartitionBoxMap::Entry entry = iterator.Next(); + PartitionBox box = entry.value; + BRect frame = box.frame; + if (entry.key == fSelectedPartition) { + fView->SetHighColor(80, 80, 80); + frame.InsetBy(-2, -2); + fView->StrokeRect(frame); + frame.InsetBy(1, 1); + fView->StrokeRect(frame); + frame.InsetBy(1, 1); + } + + fView->SetHighColor(box.color); + fView->FillRect(frame); + } + } + private: rgb_color _NextColor() @@ -103,6 +140,7 @@ BView* fView; PartitionBoxMap fBoxMap; int32 fColorIndex; + partition_id fSelectedPartition; }; @@ -114,7 +152,7 @@ , fDisk(NULL) , fSelectedParition(-1) { - for (int32 i = 0; i < 256; i++) { + for (int32 i = 0; i < kMaxPartitionColors; i++) { kPartitionColors[i].red = (i * 1675) & 0xff; kPartitionColors[i].green = (i * 318) & 0xff; kPartitionColors[i].blue = (i * 9328) & 0xff; @@ -144,12 +182,19 @@ // TODO: render the partitions (use PartitionDrawer to iterate our disk) SetHighColor(255, 255, 120); FillRect(bounds); + + PartitionDrawer drawer(this, fSelectedParition); + BDiskDeviceRoster roster; + roster.VisitEachPartition(&drawer, fDisk); + + drawer.Draw(this); } void DiskView::SetDisk(BDiskDevice* disk, partition_id selectedPartition) { +printf("DiskView::SetDisk(%p, %ld)\n", disk, selectedPartition); delete fDisk; fDisk = disk; fSelectedParition = selectedPartition; Modified: haiku/trunk/src/preferences/drivesetup/MainWindow.cpp =================================================================== --- haiku/trunk/src/preferences/drivesetup/MainWindow.cpp 2008-01-08 22:31:35 UTC (rev 23289) +++ haiku/trunk/src/preferences/drivesetup/MainWindow.cpp 2008-01-08 22:35:45 UTC (rev 23290) @@ -298,8 +298,8 @@ { fPartitionList->AddPartition(device); - printf("Visit(%p)\n", device); - dump_partition_info(device); +// printf("Visit(%p)\n", device); +// dump_partition_info(device); return false; // Don't stop yet! } @@ -310,8 +310,8 @@ { fPartitionList->AddPartition(partition); - printf("Visit(%p, %ld)\n", partition, level); - dump_partition_info(partition); +// printf("Visit(%p, %ld)\n", partition, level); +// dump_partition_info(partition); return false; // Don't stop yet! } Modified: haiku/trunk/src/preferences/drivesetup/PartitionList.cpp =================================================================== --- haiku/trunk/src/preferences/drivesetup/PartitionList.cpp 2008-01-08 22:31:35 UTC (rev 23289) +++ haiku/trunk/src/preferences/drivesetup/PartitionList.cpp 2008-01-08 22:35:45 UTC (rev 23290) @@ -12,55 +12,62 @@ #include +static const char* kUnavailableString = ""; + +enum { +// kBitmapColumn, + kDeviceColumn, + kFilesystemColumn, + kVolumeNameColumn, + kMountedAtColumn, + kSizeColumn +}; + + PartitionListRow::PartitionListRow(BPartition* partition) : Inherited() , fPartitionID(partition->ID()) { +// SetField(new BBitmapField(NULL), kBitmapColumn); + BPath path; - char size[1024]; - partition->GetPath(&path); + SetField(new BStringField(path.Path()), kDeviceColumn); - SetField(new BBitmapField(NULL), 0); - -// if (partition->IsDevice()) // Only show device path for actual devices (so only for /dev/disk/..../raw entries) - SetField(new BStringField(path.Path()), 1); -// else -// SetField(new BStringField("n/a"), 1); - // if (partition->ContainsPartitioningSystem()) { -// SetField(new BStringField(partition->ContentType()), 2); +// SetField(new BStringField(partition->ContentType()), kFilesystemColumn); // } else { -// SetField(new BStringField("n/a"), 2); +// SetField(new BStringField(kUnavailableString), kFilesystemColumn); // } if (partition->ContainsFileSystem()) { - SetField(new BStringField(partition->ContentType()), 2); // Filesystem - SetField(new BStringField(partition->ContentName()), 3); // Volume Name + SetField(new BStringField(partition->ContentType()), kFilesystemColumn); + SetField(new BStringField(partition->ContentName()), kVolumeNameColumn); } else { - SetField(new BStringField("n/a"), 2); - SetField(new BStringField("n/a"), 3); + SetField(new BStringField(kUnavailableString), kFilesystemColumn); + SetField(new BStringField(kUnavailableString), kVolumeNameColumn); } if (partition->IsMounted() && partition->GetMountPoint(&path) == B_OK) { - SetField(new BStringField(path.Path()), 4); + SetField(new BStringField(path.Path()), kMountedAtColumn); } else { - SetField(new BStringField("n/a"), 4); + SetField(new BStringField(kUnavailableString), kMountedAtColumn); } - SetField(new BStringField(string_for_size(partition->Size(), size)), 5); + char size[1024]; + SetField(new BStringField(string_for_size(partition->Size(), size)), kSizeColumn); } PartitionListView::PartitionListView(const BRect& frame, uint32 resizeMode) : Inherited(frame, "storagelist", resizeMode, 0, B_NO_BORDER, true) { - AddColumn(new BBitmapColumn("", 20, 20, 100, B_ALIGN_CENTER), 0); - AddColumn(new BStringColumn("Device", 100, 50, 500, B_TRUNCATE_MIDDLE), 1); - AddColumn(new BStringColumn("Filesystem", 100, 50, 500, B_TRUNCATE_MIDDLE), 2); - AddColumn(new BStringColumn("Volume Name", 100, 50, 500, B_TRUNCATE_MIDDLE), 3); - AddColumn(new BStringColumn("Mounted At", 100, 50, 500, B_TRUNCATE_MIDDLE), 4); - AddColumn(new BStringColumn("Size", 100, 50, 500, B_TRUNCATE_END), 5); +// AddColumn(new BBitmapColumn("", 20, 20, 100, B_ALIGN_CENTER), kBitmapColumn); + AddColumn(new BStringColumn("Device", 150, 50, 500, B_TRUNCATE_MIDDLE), kDeviceColumn); + AddColumn(new BStringColumn("Filesystem", 100, 50, 500, B_TRUNCATE_MIDDLE), kFilesystemColumn); + AddColumn(new BStringColumn("Volume Name", 130, 50, 500, B_TRUNCATE_MIDDLE), kVolumeNameColumn); + AddColumn(new BStringColumn("Mounted At", 100, 50, 500, B_TRUNCATE_MIDDLE), kMountedAtColumn); + AddColumn(new BStringColumn("Size", 100, 50, 500, B_TRUNCATE_END, B_ALIGN_RIGHT), kSizeColumn); } From mmu_man at mail.berlios.de Tue Jan 8 23:48:00 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 8 Jan 2008 23:48:00 +0100 Subject: [Haiku-commits] r23291 - haiku/trunk/src/apps/codycam Message-ID: <200801082248.m08Mm006010874@sheep.berlios.de> Author: mmu_man Date: 2008-01-08 23:47:59 +0100 (Tue, 08 Jan 2008) New Revision: 23291 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23291&view=rev Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp Log: When running with relative path, Zeta complains: "Don't change the current working directory before creating the BApplication.". Should work this way. Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp =================================================================== --- haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-01-08 22:35:45 UTC (rev 23290) +++ haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-01-08 22:47:59 UTC (rev 23291) @@ -124,6 +124,7 @@ fPort(0), fVideoControlWindow(NULL) { + chdir("/boot/home"); } @@ -922,7 +923,6 @@ int main() { - chdir("/boot/home"); CodyCam app; app.Run(); return 0; From stippi at mail.berlios.de Wed Jan 9 00:35:55 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 9 Jan 2008 00:35:55 +0100 Subject: [Haiku-commits] r23292 - haiku/trunk/src/kits/storage/disk_device Message-ID: <200801082335.m08NZtl2008050@sheep.berlios.de> Author: stippi Date: 2008-01-09 00:35:51 +0100 (Wed, 09 Jan 2008) New Revision: 23292 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23292&view=rev Modified: haiku/trunk/src/kits/storage/disk_device/DiskDeviceRoster.cpp Log: * VisitEachPartition() was not working correctly, terminatedEarly was not maintained Modified: haiku/trunk/src/kits/storage/disk_device/DiskDeviceRoster.cpp =================================================================== --- haiku/trunk/src/kits/storage/disk_device/DiskDeviceRoster.cpp 2008-01-08 22:47:59 UTC (rev 23291) +++ haiku/trunk/src/kits/storage/disk_device/DiskDeviceRoster.cpp 2008-01-08 23:35:51 UTC (rev 23292) @@ -212,8 +212,13 @@ BDiskDevice deviceOnStack; BDiskDevice *useDevice = (device ? device : &deviceOnStack); BPartition *foundPartition = NULL; - while (!foundPartition && GetNextDevice(useDevice) == B_OK) + while (GetNextDevice(useDevice) == B_OK) { foundPartition = useDevice->VisitEachDescendant(visitor); + if (foundPartition) { + terminatedEarly = true; + break; + } + } fDeviceCookie = oldCookie; if (!terminatedEarly) useDevice->Unset(); From marcusoverhagen at mail.berlios.de Wed Jan 9 01:17:56 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 01:17:56 +0100 Subject: [Haiku-commits] r23293 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801090017.m090Hueq008758@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 01:17:51 +0100 (Wed, 09 Jan 2008) New Revision: 23293 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23293&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c Log: cleanup of the rescanning code Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-08 23:35:51 UTC (rev 23292) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 00:17:51 UTC (rev 23293) @@ -845,32 +845,34 @@ ide_bus_info *bus = device->bus; int status; - TRACE("ata_read_infoblock: device %p, isAtapi %d\n", device, isAtapi); + TRACE("ata_read_infoblock: bus %p, device %d, isAtapi %d\n", device->bus, device->is_device1, isAtapi); // disable interrupts bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3 | ide_devctrl_nien); - device->tf_param_mask = 0; - device->tf.write.command = isAtapi ? IDE_CMD_IDENTIFY_PACKET_DEVICE : IDE_CMD_IDENTIFY_DEVICE; - // initialize device selection flags, // this is the only place where this bit gets initialized in the task file if (bus->controller->read_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_device_head) != B_OK) { TRACE("ata_read_infoblock: read_command_block_regs failed\n"); - return B_ERROR; + goto error; } - device->tf.lba.device = device->is_device1; + ata_select_device(device->bus, device->is_device1); + device->tf.lba.device = device->is_device1; // XXX fix me + + device->tf_param_mask = 0; + device->tf.write.command = isAtapi ? IDE_CMD_IDENTIFY_PACKET_DEVICE : IDE_CMD_IDENTIFY_DEVICE; + if (!send_command(device, NULL, isAtapi ? false : true, 20, ide_state_sync_waiting)) { TRACE("ata_read_infoblock: send_command failed\n"); - return B_ERROR; + goto error; } if (ata_wait(bus, ide_status_drq, ide_status_bsy, true, 4000000) != B_OK) { TRACE("ata_read_infoblock: wait failed\n"); - return B_ERROR; + goto error; } // get the infoblock @@ -879,9 +881,21 @@ if (!wait_for_drqdown(device)) { TRACE("scan_device_int: wait_for_drqdown failed\n"); - return false; + goto error; } + IDE_LOCK(bus); + bus->state = ide_state_idle; + cancel_timer(&bus->timer.te); + IDE_UNLOCK(bus); + TRACE("ata_read_infoblock: success\n"); return B_OK; + +error: + IDE_LOCK(bus); + bus->state = ide_state_idle; + cancel_timer(&bus->timer.te); + IDE_UNLOCK(bus); + return B_ERROR; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c 2008-01-08 23:35:51 UTC (rev 23292) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c 2008-01-09 00:17:51 UTC (rev 23293) @@ -54,22 +54,20 @@ status_t -reset_bus(ide_bus_info *bus, uint32 *sigDev0, uint32 *sigDev1) +reset_bus(ide_bus_info *bus, bool *devicePresent0, uint32 *sigDev0, bool *devicePresent1, uint32 *sigDev1) { ide_controller_interface *controller = bus->controller; ide_channel_cookie channel = bus->channel_cookie; ide_task_file tf; status_t status; - bool devicePresent0; - bool devicePresent1; dprintf("ATA: reset_bus %p\n", bus); - devicePresent0 = ata_is_device_present(bus, 0); - devicePresent1 = ata_is_device_present(bus, 1); + *devicePresent0 = ata_is_device_present(bus, 0); + *devicePresent1 = ata_is_device_present(bus, 1); - dprintf("ATA: reset_bus: ata_is_device_present device 0, present %d\n", devicePresent0); - dprintf("ATA: reset_bus: ata_is_device_present device 1, present %d\n", devicePresent1); + dprintf("ATA: reset_bus: ata_is_device_present device 0, present %d\n", *devicePresent0); + dprintf("ATA: reset_bus: ata_is_device_present device 1, present %d\n", *devicePresent1); // disable interrupts and assert SRST for at least 5 usec if (controller->write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien | ide_devctrl_srst) != B_OK) @@ -81,7 +79,7 @@ goto error; snooze(150000); - if (devicePresent0) { + if (*devicePresent0) { ata_select_device(bus, 0); dprintf("altstatus device 0: %x\n", controller->get_altstatus(channel)); @@ -108,7 +106,7 @@ *sigDev0 = 0; } - if (devicePresent1) { + if (*devicePresent1) { ata_select_device(bus, 1); dprintf("altstatus device 1: %x\n", controller->get_altstatus(channel)); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-08 23:35:51 UTC (rev 23292) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-09 00:17:51 UTC (rev 23293) @@ -184,108 +184,6 @@ } -/** read info block of ATA or ATAPI device */ -/* -static bool -scan_device_int(ide_device_info *device, bool atapi) -{ - ide_bus_info *bus = device->bus; - int status; - - TRACE("scan_device_int: device %p, atapi %d\n", device, atapi); - - device->tf_param_mask = 0; - device->tf.write.command = atapi ? IDE_CMD_IDENTIFY_PACKET_DEVICE - : IDE_CMD_IDENTIFY_DEVICE; - - // initialize device selection flags, - // this is the only place where this bit gets initialized in the task file - if (bus->controller->read_command_block_regs(bus->channel_cookie, &device->tf, - ide_mask_device_head) != B_OK) { - TRACE("scan_device_int: read_command_block_regs failed\n"); - return false; - } - - device->tf.lba.device = device->is_device1; - - if (!send_command(device, NULL, atapi ? false : true, 20, ide_state_sync_waiting)) { - TRACE("scan_device_int: send_command failed\n"); - return false; - } - - // do a short wait first - if there's no device at all we could wait forever - // ToDo: have a look at this; if it times out (when the time is too short), - // the kernel seems to crash a little later)! - TRACE("scan_device_int: waiting 100ms...\n"); - if (acquire_sem_etc(bus->sync_wait_sem, 1, B_RELATIVE_TIMEOUT, 100000) == B_TIMED_OUT) { - bool cont; - - TRACE("scan_device_int: no fast response to inquiry\n"); - - // check the busy flag - if it's still set, there's probably no device - IDE_LOCK(bus); - - status = bus->controller->get_altstatus(bus->channel_cookie); - cont = (status & ide_status_bsy) == ide_status_bsy; - - IDE_UNLOCK(bus); - - TRACE("scan_device_int: status %#04x\n", status); - - if (!cont) { - TRACE("scan_device_int: busy bit not set after 100ms - probably noone there\n"); - // no reaction -> abort waiting - cancel_irq_timeout(bus); - - // timeout or irq may have been fired, reset semaphore just is case - acquire_sem_etc(bus->sync_wait_sem, 1, B_RELATIVE_TIMEOUT, 0); - - TRACE("scan_device_int: aborting because busy bit not set\n"); - return false; - } - - TRACE("scan_device_int: busy bit set, give device more time\n"); - - // there is something, so wait for it - acquire_sem(bus->sync_wait_sem); - } - TRACE("scan_device_int: got a fast response\n"); - - // cancel the timeout manually; usually this is done by wait_for_sync(), but - // we've used the wait semaphore directly - cancel_irq_timeout(bus); - - if (bus->sync_wait_timeout) { - TRACE("scan_device_int: aborting on sync_wait_timeout\n"); - return false; - } - - ide_wait(device, ide_status_drq, ide_status_bsy, true, 1000); - - status = bus->controller->get_altstatus(bus->channel_cookie); - - if ((status & ide_status_err) != 0) { - // if there's no device, all bits including the error bit are set - TRACE("scan_device_int: error bit set - no device or wrong type (status: %#04x)\n", status); - return false; - } - - // get the infoblock - bus->controller->read_pio(bus->channel_cookie, (uint16 *)&device->infoblock, - sizeof(device->infoblock) / sizeof(uint16), false); - - if (!wait_for_drqdown(device)) { - TRACE("scan_device_int: wait_for_drqdown failed\n"); - return false; - } - - TRACE("scan_device_int: device found\n"); - - prep_infoblock(device); - return true; -} -*/ - /** scan one device */ status_t scan_device(ide_device_info *device, bool isAtapi) @@ -297,49 +195,8 @@ return B_ERROR; } + device->subsys_status = SCSI_REQ_CMP; + prep_infoblock(device); return B_OK; } - -/* -void -scan_device_worker(ide_bus_info *bus, void *arg) -{ - int is_device1 = (int)arg; - ide_device_info *device; - - TRACE("scan_device_worker: bus %p, device-number %d\n", bus, is_device1); - - // forget everything we know about the device; - // don't care about peripheral drivers using this device - // as the device info is only used by us and not published - // directly or indirectly to the SCSI bus manager - if (bus->devices[is_device1]) - destroy_device(bus->devices[is_device1]); - - device = create_device(bus, is_device1); - - // reset status so we can see what goes wrong during detection - device->subsys_status = SCSI_REQ_CMP; - - if (scan_device_int(device, false)) { - if (!prep_ata(device)) - goto err; - } else if (device->subsys_status != SCSI_TID_INVALID - && scan_device_int(device, true)) { - // only try ATAPI if there is at least some device - // (see send_command - this error code must be unique!) - if (!prep_atapi(device)) - goto err; - } else - goto err; - - bus->state = ide_state_idle; - return; - -err: - destroy_device(device); - - bus->state = ide_state_idle; -} -*/ \ No newline at end of file Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-08 23:35:51 UTC (rev 23292) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-09 00:17:51 UTC (rev 23293) @@ -365,7 +365,7 @@ bool check_service_req(ide_device_info *device); -status_t reset_bus(ide_bus_info *bus, uint32 *sigDev0, uint32 *sigDev1); +status_t reset_bus(ide_bus_info *bus, bool *devicePresent0, uint32 *sigDev0, bool *devicePresent1, uint32 *sigDev1); // channel_mgr.c Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-08 23:35:51 UTC (rev 23292) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 00:17:51 UTC (rev 23293) @@ -228,46 +228,45 @@ } -static uchar -sim_scan_bus(ide_bus_info *bus) +static void +scan_bus(ide_bus_info *bus) { uint32 deviceSignature[2]; + bool devicePresent[2]; ide_device_info *device; status_t status; bool isAtapi; int i; - dprintf("ATA: sim_scan_bus: bus %p\n", bus); + dprintf("ATA: scan_bus: bus %p\n", bus); if (bus->disconnected) - return SCSI_NO_HBA; + return; -// IDE_LOCK(bus); + status = reset_bus(bus, &devicePresent[0], &deviceSignature[0], &devicePresent[1], &deviceSignature[1]); - status = reset_bus(bus, &deviceSignature[0], &deviceSignature[1]); - for (i = 0; i < bus->max_devices; ++i) { if (bus->devices[i]) destroy_device(bus->devices[i]); - if (status == B_OK && deviceSignature[i] != 0) { + if (status == B_OK && devicePresent[i]) { isAtapi = deviceSignature[i] == 0xeb140101; + dprintf("ATA: scan_bus: bus %p, creating device %d\n", bus, i); device = create_device(bus, i /* isDevice1 */); - if (scan_device(device, isAtapi) != B_OK) + if (scan_device(device, isAtapi) != B_OK) { + dprintf("ATA: scan_bus: bus %p, scanning failed, destroying device %d\n", bus, i); destroy_device(device); + } } } -// IDE_UNLOCK(bus); - dprintf("ATA: sim_scan_bus: bus %p finished\n", bus); - - return SCSI_REQ_CMP; + dprintf("ATA: scan_bus: bus %p finished\n", bus); } static uchar -sim_not_scan_bus(ide_bus_info *bus) +sim_rescan_bus(ide_bus_info *bus) { - dprintf("ATA: sim_not_scan_bus\n"); + dprintf("ATA: sim_rescan_bus\n"); return SCSI_REQ_CMP; } @@ -667,7 +666,7 @@ */ // detect devices - sim_scan_bus(bus); + scan_bus(bus); return B_OK; err5: @@ -857,7 +856,7 @@ (uchar (*)(scsi_sim_cookie, scsi_ccb *)) sim_term_io, (uchar (*)(scsi_sim_cookie, scsi_path_inquiry *))sim_path_inquiry, - (uchar (*)(scsi_sim_cookie)) sim_not_scan_bus, + (uchar (*)(scsi_sim_cookie)) sim_rescan_bus, (uchar (*)(scsi_sim_cookie)) sim_reset_bus, (void (*)(scsi_sim_cookie, uchar, From stippi at mail.berlios.de Wed Jan 9 01:30:25 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 9 Jan 2008 01:30:25 +0100 Subject: [Haiku-commits] r23294 - haiku/trunk/src/preferences/drivesetup Message-ID: <200801090030.m090UPq6020520@sheep.berlios.de> Author: stippi Date: 2008-01-09 01:30:24 +0100 (Wed, 09 Jan 2008) New Revision: 23294 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23294&view=rev Modified: haiku/trunk/src/preferences/drivesetup/DiskView.cpp haiku/trunk/src/preferences/drivesetup/DiskView.h haiku/trunk/src/preferences/drivesetup/MainWindow.cpp Log: * cache the result of visiting the partitions * make sure the colors are bright enough Modified: haiku/trunk/src/preferences/drivesetup/DiskView.cpp =================================================================== --- haiku/trunk/src/preferences/drivesetup/DiskView.cpp 2008-01-09 00:17:51 UTC (rev 23293) +++ haiku/trunk/src/preferences/drivesetup/DiskView.cpp 2008-01-09 00:30:24 UTC (rev 23294) @@ -60,13 +60,13 @@ }; -class PartitionDrawer : public BDiskDeviceVisitor { +class DiskView::PartitionDrawer : public BDiskDeviceVisitor { public: - PartitionDrawer(BView* view, partition_id selectedPartition) + PartitionDrawer(BView* view) : fView(view) , fBoxMap() , fColorIndex(0) - , fSelectedPartition(selectedPartition) + , fSelectedPartition(-1) { } @@ -103,6 +103,11 @@ return false; } + void SetSelectedPartition(partition_id id) + { + fSelectedPartition = id; + } + void Draw(BView* view) { PartitionBoxMap::Iterator iterator = fBoxMap.GetIterator(); @@ -150,12 +155,12 @@ DiskView::DiskView(const BRect& frame, uint32 resizeMode) : Inherited(frame, "diskview", resizeMode, B_WILL_DRAW) , fDisk(NULL) - , fSelectedParition(-1) + , fPartitionDrawer(new PartitionDrawer(this)) { for (int32 i = 0; i < kMaxPartitionColors; i++) { - kPartitionColors[i].red = (i * 1675) & 0xff; - kPartitionColors[i].green = (i * 318) & 0xff; - kPartitionColors[i].blue = (i * 9328) & 0xff; + kPartitionColors[i].red = 120 + ((i * 1675) & 120); + kPartitionColors[i].green = 120 + ((i * 318) & 120); + kPartitionColors[i].blue = 120 + ((i * 9328) & 120); kPartitionColors[i].alpha = 255; } } @@ -164,6 +169,7 @@ DiskView::~DiskView() { SetDisk(NULL, -1); + delete fPartitionDrawer; } @@ -179,25 +185,19 @@ return; } - // TODO: render the partitions (use PartitionDrawer to iterate our disk) - SetHighColor(255, 255, 120); - FillRect(bounds); - - PartitionDrawer drawer(this, fSelectedParition); - BDiskDeviceRoster roster; - roster.VisitEachPartition(&drawer, fDisk); - - drawer.Draw(this); + fPartitionDrawer->Draw(this); } void DiskView::SetDisk(BDiskDevice* disk, partition_id selectedPartition) { -printf("DiskView::SetDisk(%p, %ld)\n", disk, selectedPartition); delete fDisk; fDisk = disk; - fSelectedParition = selectedPartition; + fPartitionDrawer->SetSelectedPartition(selectedPartition); + BDiskDeviceRoster roster; + roster.VisitEachPartition(fPartitionDrawer, fDisk); + Invalidate(); } Modified: haiku/trunk/src/preferences/drivesetup/DiskView.h =================================================================== --- haiku/trunk/src/preferences/drivesetup/DiskView.h 2008-01-09 00:17:51 UTC (rev 23293) +++ haiku/trunk/src/preferences/drivesetup/DiskView.h 2008-01-09 00:30:24 UTC (rev 23294) @@ -24,7 +24,9 @@ partition_id selectedPartition); private: BDiskDevice* fDisk; - partition_id fSelectedParition; + + class PartitionDrawer; + PartitionDrawer* fPartitionDrawer; }; Modified: haiku/trunk/src/preferences/drivesetup/MainWindow.cpp =================================================================== --- haiku/trunk/src/preferences/drivesetup/MainWindow.cpp 2008-01-09 00:17:51 UTC (rev 23293) +++ haiku/trunk/src/preferences/drivesetup/MainWindow.cpp 2008-01-09 00:30:24 UTC (rev 23294) @@ -165,7 +165,6 @@ break; case MSG_PARTITION_ROW_SELECTED: - printf("MSG_PARTITION_ROW_SELECTED\n"); _AdaptToSelectedPartition(); break; From colacoder at mail.berlios.de Wed Jan 9 11:20:08 2008 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Wed, 9 Jan 2008 11:20:08 +0100 Subject: [Haiku-commits] r23295 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200801091020.m09AK8d4005941@sheep.berlios.de> Author: colacoder Date: 2008-01-09 11:20:07 +0100 (Wed, 09 Jan 2008) New Revision: 23295 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23295&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.c haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.c haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hooks.c Log: [HDA] When controller has multiple codecs, make sure we try to use the one with audio features. This should improve laptop support. More to come ;) Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h 2008-01-09 00:30:24 UTC (rev 23294) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h 2008-01-09 10:20:07 UTC (rev 23295) @@ -190,6 +190,7 @@ rirb_t* rirb; hda_codec* codecs[HDA_MAXCODECS]; + hda_codec* active_codec; uint32 num_codecs; hda_stream* streams[HDA_MAXSTREAMS]; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.c 2008-01-09 00:30:24 UTC (rev 23294) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.c 2008-01-09 10:20:07 UTC (rev 23295) @@ -499,7 +499,14 @@ if (ctrlr->codecsts & (1 << idx)) hda_codec_new(ctrlr, idx); - if (ctrlr->codecs[0] != NULL) + for (idx=0; idx < HDA_MAXCODECS; idx++) { + if (ctrlr->codecs[idx] && ctrlr->codecs[idx]->num_afgs) { + ctrlr->active_codec = ctrlr->codecs[idx]; + break; + } + } + + if (ctrlr->active_codec != NULL) return B_OK; else rc = ENODEV; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.c 2008-01-09 00:30:24 UTC (rev 23294) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.c 2008-01-09 10:20:07 UTC (rev 23295) @@ -272,7 +272,7 @@ hda_codec* codec = (hda_codec*)cookie; hda_afg* afg; - /* FIXME: Make sure we have a valid codec & afg... */ + /* FIXME: We should simply pass the afg into here... */ if (!codec || codec->num_afgs == 0) return ENODEV; @@ -282,20 +282,20 @@ case B_MULTI_GET_DESCRIPTION: return get_description(afg, arg); case B_MULTI_GET_EVENT_INFO: return B_ERROR; case B_MULTI_SET_EVENT_INFO: return B_ERROR; - case B_MULTI_GET_EVENT: return B_ERROR; + case B_MULTI_GET_EVENT: return B_ERROR; case B_MULTI_GET_ENABLED_CHANNELS: return get_enabled_channels(afg, arg); case B_MULTI_SET_ENABLED_CHANNELS: return B_OK; case B_MULTI_GET_GLOBAL_FORMAT: return get_global_format(afg, arg); case B_MULTI_SET_GLOBAL_FORMAT: return set_global_format(afg, arg); case B_MULTI_GET_CHANNEL_FORMATS: return B_ERROR; case B_MULTI_SET_CHANNEL_FORMATS: return B_ERROR; - case B_MULTI_GET_MIX: return B_ERROR; - case B_MULTI_SET_MIX: return B_ERROR; + case B_MULTI_GET_MIX: return B_ERROR; + case B_MULTI_SET_MIX: return B_ERROR; case B_MULTI_LIST_MIX_CHANNELS: return list_mix_channels(afg, arg); case B_MULTI_LIST_MIX_CONTROLS: return list_mix_controls(afg, arg); case B_MULTI_LIST_MIX_CONNECTIONS: return list_mix_connections(afg, arg); - case B_MULTI_GET_BUFFERS: return get_buffers(afg, arg); - case B_MULTI_SET_BUFFERS: return B_ERROR; + case B_MULTI_GET_BUFFERS: return get_buffers(afg, arg); + case B_MULTI_SET_BUFFERS: return B_ERROR; case B_MULTI_SET_START_TIME: return B_ERROR; case B_MULTI_BUFFER_EXCHANGE: return buffer_exchange(afg, arg); case B_MULTI_BUFFER_FORCE_STOP: return buffer_force_stop(afg); Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hooks.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hooks.c 2008-01-09 00:30:24 UTC (rev 23294) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hooks.c 2008-01-09 10:20:07 UTC (rev 23295) @@ -24,7 +24,7 @@ return rc; hc->opened++; - + *cookie = hc; return B_OK; } @@ -47,9 +47,9 @@ hda_control (void* cookie, uint32 op, void* arg, size_t len) { hda_controller* hc = (hda_controller*)cookie; - if (hc->codecs[0]) - return multi_audio_control(hc->codecs[0], op, arg, len); - + if (hc->active_codec) + return multi_audio_control(hc->active_codec, op, arg, len); + return B_BAD_VALUE; } @@ -73,10 +73,10 @@ } device_hooks driver_hooks = { - hda_open, /* -> open entry point */ - hda_close, /* -> close entry point */ - hda_free, /* -> free cookie */ + hda_open, /* -> open entry point */ + hda_close, /* -> close entry point */ + hda_free, /* -> free cookie */ hda_control, /* -> control entry point */ - hda_read, /* -> read entry point */ - hda_write /* -> write entry point */ + hda_read, /* -> read entry point */ + hda_write /* -> write entry point */ }; From stippi at mail.berlios.de Wed Jan 9 11:36:47 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 9 Jan 2008 11:36:47 +0100 Subject: [Haiku-commits] r23296 - haiku/trunk/src/preferences/menu Message-ID: <200801091036.m09Aalu4007539@sheep.berlios.de> Author: stippi Date: 2008-01-09 11:36:47 +0100 (Wed, 09 Jan 2008) New Revision: 23296 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23296&view=rev Modified: haiku/trunk/src/preferences/menu/ColorWindow.cpp haiku/trunk/src/preferences/menu/ColorWindow.h haiku/trunk/src/preferences/menu/MenuBar.cpp haiku/trunk/src/preferences/menu/MenuBar.h haiku/trunk/src/preferences/menu/MenuSettings.cpp haiku/trunk/src/preferences/menu/MenuSettings.h haiku/trunk/src/preferences/menu/MenuWindow.cpp haiku/trunk/src/preferences/menu/MenuWindow.h Log: applied patch by aldeck: * the Revert button always returns to the settings which were active when the preflet was started * the Defaults button always applies the default settings (the Revert button then still reverts to the original settings instead of those which were active when "Defaults" was pressed) * the enabled state of the two buttons is correctly maintained * code cleanup and refactoring Thanks a lot, aldeck! Modified: haiku/trunk/src/preferences/menu/ColorWindow.cpp =================================================================== --- haiku/trunk/src/preferences/menu/ColorWindow.cpp 2008-01-09 10:20:07 UTC (rev 23295) +++ haiku/trunk/src/preferences/menu/ColorWindow.cpp 2008-01-09 10:36:47 UTC (rev 23296) @@ -9,6 +9,7 @@ #include "ColorWindow.h" +#include "MenuSettings.h" #include "msg.h" #include @@ -22,9 +23,9 @@ B_NOT_ZOOMABLE | B_NOT_RESIZABLE), fOwner(owner) { - // Set and collect the variables for revert - get_menu_info(&fInfo); - get_menu_info(&fRevertInfo); + fCurrentColor = MenuSettings::GetInstance()->BackgroundColor(); + fPreviousColor = MenuSettings::GetInstance()->PreviousBackgroundColor(); + fDefaultColor = MenuSettings::GetInstance()->DefaultBackgroundColor(); BView *topView = new BView(Bounds(), "topView", B_FOLLOW_ALL_SIDES, 0); topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -32,7 +33,7 @@ fColorControl = new BColorControl(BPoint(10, 10), B_CELLS_32x8, 9, "COLOR", new BMessage(MENU_COLOR), true); - fColorControl->SetValue(fInfo.background_color); + fColorControl->SetValue(fCurrentColor); fColorControl->ResizeToPreferred(); topView->AddChild(fColorControl); @@ -44,7 +45,7 @@ new BMessage(MENU_COLOR_DEFAULT), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); fDefaultButton->ResizeToPreferred(); - fDefaultButton->SetEnabled(false); + fDefaultButton->SetEnabled(fCurrentColor != fDefaultColor); topView->AddChild(fDefaultButton); rect.OffsetBy(fDefaultButton->Bounds().Width() + 10, 0); @@ -52,7 +53,7 @@ new BMessage(MENU_REVERT), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); fRevertButton->ResizeToPreferred(); - fRevertButton->SetEnabled(false); + fRevertButton->SetEnabled(fCurrentColor != fPreviousColor); topView->AddChild(fRevertButton); ResizeTo(fColorControl->Bounds().Width() + 20, fRevertButton->Frame().bottom + 10); @@ -68,45 +69,41 @@ void +ColorWindow::_UpdateAndPost() +{ + fDefaultButton->SetEnabled(fCurrentColor != fDefaultColor); + fRevertButton->SetEnabled(fCurrentColor != fPreviousColor); + + fCurrentColor = fColorControl->ValueAsColor(); + + menu_info info; + get_menu_info(&info); + info.background_color = fCurrentColor; + set_menu_info(&info); + + be_app->PostMessage(MENU_COLOR); +} + + +void ColorWindow::MessageReceived(BMessage *msg) { switch (msg->what) { case MENU_REVERT: - fColorControl->SetValue(fRevertInfo.background_color); - fInfo.background_color = fColorControl->ValueAsColor(); - set_menu_info(&fInfo); - be_app->PostMessage(UPDATE_WINDOW); - fRevertButton->SetEnabled(false); + fColorControl->SetValue(fPreviousColor); + _UpdateAndPost(); break; - case MENU_COLOR_DEFAULT: - // change to system color for system wide - // compatability - rgb_color color; - color.red = 216; - color.blue = 216; - color.green = 216; - color.alpha = 255; - fColorControl->SetValue(color); - fDefaultButton->SetEnabled(false); - get_menu_info(&fInfo); - fInfo.background_color = fColorControl->ValueAsColor(); - set_menu_info(&fInfo); - be_app->PostMessage(MENU_COLOR); + case MENU_COLOR_DEFAULT: + fColorControl->SetValue(fDefaultColor); + _UpdateAndPost(); break; case MENU_COLOR: - get_menu_info(&fInfo); - fRevertInfo.background_color = fInfo.background_color; - fInfo.background_color = fColorControl->ValueAsColor(); - set_menu_info(&fInfo); - be_app->PostMessage(MENU_COLOR); - fDefaultButton->SetEnabled(true); - fRevertButton->SetEnabled(true); + _UpdateAndPost(); break; default: - be_app->PostMessage(UPDATE_WINDOW); BWindow::MessageReceived(msg); break; } Modified: haiku/trunk/src/preferences/menu/ColorWindow.h =================================================================== --- haiku/trunk/src/preferences/menu/ColorWindow.h 2008-01-09 10:20:07 UTC (rev 23295) +++ haiku/trunk/src/preferences/menu/ColorWindow.h 2008-01-09 10:36:47 UTC (rev 23296) @@ -27,12 +27,16 @@ virtual void Quit(); virtual void MessageReceived(BMessage* message); + private: + void _UpdateAndPost(); + private: - BColorControl* fColorControl; + BColorControl* fColorControl; BButton* fDefaultButton; - BButton* fRevertButton; - menu_info fRevertInfo; - menu_info fInfo; + BButton* fRevertButton; + rgb_color fCurrentColor; + rgb_color fPreviousColor; + rgb_color fDefaultColor; BMessenger fOwner; }; Modified: haiku/trunk/src/preferences/menu/MenuBar.cpp =================================================================== --- haiku/trunk/src/preferences/menu/MenuBar.cpp 2008-01-09 10:20:07 UTC (rev 23295) +++ haiku/trunk/src/preferences/menu/MenuBar.cpp 2008-01-09 10:36:47 UTC (rev 23296) @@ -20,16 +20,12 @@ #include #include -#include -#include - MenuBar::MenuBar() : BMenuBar(BRect(40, 10, 10, 10), "menu", B_FOLLOW_TOP | B_FRAME_EVENTS, B_ITEMS_IN_COLUMN, true) { - _BuildMenu(); - UpdateMenu(); + _BuildMenu(); SetItemMargins(14.0, 2.0, 20.0, 0.0); } @@ -81,38 +77,19 @@ void -MenuBar::UpdateMenu() +MenuBar::Update() { menu_info info; MenuSettings::GetInstance()->Get(info); fAlwaysShowTriggersItem->SetMarked(info.triggers_always_shown); - key_map *keys; - char* chars; - get_key_map(&keys, &chars); - - bool altAsShortcut = (keys->left_command_key == 0x5d) - && (keys->right_command_key == 0x5f); - - free(chars); - free(keys); - + bool altAsShortcut = MenuSettings::GetInstance()->AltAsShortcut(); fAltAsShortcutItem->SetMarked(altAsShortcut); fControlAsShortcutItem->SetMarked(!altAsShortcut); -} - -void -MenuBar::Update() -{ - UpdateMenu(); - BFont font; if (LockLooper()) { - menu_info info; - MenuSettings::GetInstance()->Get(info); - font.SetFamilyAndStyle(info.f_family, info.f_style); font.SetSize(info.font_size); SetFont(&font); Modified: haiku/trunk/src/preferences/menu/MenuBar.h =================================================================== --- haiku/trunk/src/preferences/menu/MenuBar.h 2008-01-09 10:20:07 UTC (rev 23295) +++ haiku/trunk/src/preferences/menu/MenuBar.h 2008-01-09 10:36:47 UTC (rev 23296) @@ -18,8 +18,7 @@ MenuBar(); virtual void AttachedToWindow(); - - void UpdateMenu(); + void Update(); virtual void FrameResized(float width, float height); Modified: haiku/trunk/src/preferences/menu/MenuSettings.cpp =================================================================== --- haiku/trunk/src/preferences/menu/MenuSettings.cpp 2008-01-09 10:20:07 UTC (rev 23295) +++ haiku/trunk/src/preferences/menu/MenuSettings.cpp 2008-01-09 10:36:47 UTC (rev 23296) @@ -9,6 +9,10 @@ #include "MenuSettings.h" +#include +#include +#include +#include MenuSettings::MenuSettings() @@ -17,15 +21,22 @@ // would provide and execute this information, as it does // for get_menu_info and set_menu_info (or is this information // coming from libbe.so? or else where?). - fDefaultSettings.font_size = 12; - //info.f_family = "test"; - //info.f_style = "test"; - fDefaultSettings.background_color = ui_color(B_MENU_BACKGROUND_COLOR); + fDefaultSettings.font_size = 12; + sprintf(fDefaultSettings.f_family,"%s","Bitstream Vera Sans"); + sprintf(fDefaultSettings.f_style,"%s","Roman"); + rgb_color color; + color.red = 216; + color.blue = 216; + color.green = 216; + color.alpha = 255; + fDefaultSettings.background_color = color;//ui_color(B_MENU_BACKGROUND_COLOR); fDefaultSettings.separator = 0; fDefaultSettings.click_to_open = true; fDefaultSettings.triggers_always_shown = false; - - fPreviousSettings = fDefaultSettings; + fDefaultAltAsShortcut = true; + + get_menu_info(&fPreviousSettings); + fPreviousAltAsShortcut = AltAsShortcut(); } @@ -55,26 +66,86 @@ void MenuSettings::Set(menu_info &info) { - get_menu_info(&fPreviousSettings); set_menu_info(&info); } +bool +MenuSettings::AltAsShortcut() const +{ + key_map *keys; + char* chars; + + get_key_map(&keys, &chars); + bool altAsShortcut = (keys->left_command_key == 0x5d) + && (keys->right_command_key == 0x5f); + + free(chars); + free(keys); + + return altAsShortcut; +} + + void +MenuSettings::SetAltAsShortcut(bool altAsShortcut) +{ + if (altAsShortcut) { + // This might not be the same for all keyboards + set_modifier_key(B_LEFT_COMMAND_KEY, 0x5d); + set_modifier_key(B_RIGHT_COMMAND_KEY, 0x5f); + set_modifier_key(B_LEFT_CONTROL_KEY, 0x5c); + set_modifier_key(B_RIGHT_OPTION_KEY, 0x60); + } else { + // This might not be the same for all keyboards + set_modifier_key(B_LEFT_COMMAND_KEY, 0x5c); + set_modifier_key(B_RIGHT_COMMAND_KEY, 0x60); + set_modifier_key(B_LEFT_CONTROL_KEY, 0x5d); + set_modifier_key(B_RIGHT_OPTION_KEY, 0x5f); + } + be_roster->Broadcast(new BMessage(B_MODIFIERS_CHANGED)); +} + + +void MenuSettings::Revert() { set_menu_info(&fPreviousSettings); + SetAltAsShortcut(fPreviousAltAsShortcut); } void MenuSettings::ResetToDefaults() { - get_menu_info(&fPreviousSettings); set_menu_info(&fDefaultSettings); + SetAltAsShortcut(fDefaultAltAsShortcut); } +rgb_color +MenuSettings::BackgroundColor() const +{ + menu_info info; + get_menu_info(&info); + return info.background_color; +} + + +rgb_color +MenuSettings::PreviousBackgroundColor() const +{ + return fPreviousSettings.background_color; +} + + +rgb_color +MenuSettings::DefaultBackgroundColor() const +{ + return fDefaultSettings.background_color; +} + + bool MenuSettings::IsDefaultable() { @@ -82,9 +153,29 @@ get_menu_info(&info); return info.font_size != fDefaultSettings.font_size + || strcmp(info.f_family, fDefaultSettings.f_family) != 0 + || strcmp(info.f_style, fDefaultSettings.f_style) != 0 || info.background_color != fDefaultSettings.background_color || info.separator != fDefaultSettings.separator || info.click_to_open != fDefaultSettings.click_to_open - || info.triggers_always_shown != fDefaultSettings.triggers_always_shown; + || info.triggers_always_shown != fDefaultSettings.triggers_always_shown + || AltAsShortcut() != fDefaultAltAsShortcut; } + +bool +MenuSettings::IsRevertable() +{ + menu_info info; + get_menu_info(&info); + + return info.font_size != fPreviousSettings.font_size + || strcmp(info.f_family, fPreviousSettings.f_family) != 0 + || strcmp(info.f_style, fPreviousSettings.f_style) != 0 + || info.background_color != fPreviousSettings.background_color + || info.separator != fPreviousSettings.separator + || info.click_to_open != fPreviousSettings.click_to_open + || info.triggers_always_shown != fPreviousSettings.triggers_always_shown + || AltAsShortcut() != fPreviousAltAsShortcut; +} + Modified: haiku/trunk/src/preferences/menu/MenuSettings.h =================================================================== --- haiku/trunk/src/preferences/menu/MenuSettings.h 2008-01-09 10:20:07 UTC (rev 23295) +++ haiku/trunk/src/preferences/menu/MenuSettings.h 2008-01-09 10:36:47 UTC (rev 23296) @@ -18,17 +18,28 @@ void Get(menu_info &info) const; void Set(menu_info &info); + + bool AltAsShortcut() const; + void SetAltAsShortcut(bool altAsShortcut); + + rgb_color BackgroundColor() const; + rgb_color PreviousBackgroundColor() const; + rgb_color DefaultBackgroundColor() const; + void Revert(); void ResetToDefaults(); bool IsDefaultable(); - + bool IsRevertable(); + private: MenuSettings(); ~MenuSettings(); menu_info fPreviousSettings; - menu_info fDefaultSettings; + menu_info fDefaultSettings; + bool fPreviousAltAsShortcut; + bool fDefaultAltAsShortcut; }; #endif // MENU_SETTINGS_H Modified: haiku/trunk/src/preferences/menu/MenuWindow.cpp =================================================================== --- haiku/trunk/src/preferences/menu/MenuWindow.cpp 2008-01-09 10:20:07 UTC (rev 23295) +++ haiku/trunk/src/preferences/menu/MenuWindow.cpp 2008-01-09 10:36:47 UTC (rev 23296) @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -31,6 +30,8 @@ B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE) { fColorWindow = NULL; + + fSettings = MenuSettings::GetInstance(); BView* topView = new BView(Bounds(), "menuView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW); @@ -60,34 +61,29 @@ topView->AddChild(fRevertButton); topView->MakeFocus(); - fMenuBar->Update(); + + _UpdateAll(); } void MenuWindow::MessageReceived(BMessage *msg) { - MenuSettings *settings = MenuSettings::GetInstance(); menu_info info; switch (msg->what) { case MENU_REVERT: - settings->Revert(); - - fRevertButton->SetEnabled(false); - fDefaultsButton->SetEnabled(settings->IsDefaultable()); - fMenuBar->Update(); + fSettings->Revert(); + _UpdateAll(); break; case MENU_DEFAULT: - settings->ResetToDefaults(); - - fDefaultsButton->SetEnabled(false); - fMenuBar->Update(); + fSettings->ResetToDefaults(); + _UpdateAll(); break; case UPDATE_WINDOW: - fMenuBar->Update(); + _UpdateAll(); break; case MENU_FONT_FAMILY: @@ -98,64 +94,39 @@ const font_style *style; msg->FindString("style", (const char **)&style); - settings->Get(info); + fSettings->Get(info); strlcpy(info.f_family, (const char *)family, B_FONT_FAMILY_LENGTH); strlcpy(info.f_style, (const char *)style, B_FONT_STYLE_LENGTH); - settings->Set(info); + fSettings->Set(info); - fRevertButton->SetEnabled(true); - fDefaultsButton->SetEnabled(settings->IsDefaultable()); - fMenuBar->Update(); + _UpdateAll(); break; } case MENU_FONT_SIZE: - settings->Get(info); + fSettings->Get(info); msg->FindFloat("size", &info.font_size); - settings->Set(info); + fSettings->Set(info); - fRevertButton->SetEnabled(true); - fDefaultsButton->SetEnabled(settings->IsDefaultable()); - fMenuBar->Update(); + _UpdateAll(); break; case ALLWAYS_TRIGGERS_MSG: - settings->Get(info); + fSettings->Get(info); info.triggers_always_shown = !info.triggers_always_shown; - settings->Set(info); + fSettings->Set(info); - fRevertButton->SetEnabled(true); - fDefaultsButton->SetEnabled(settings->IsDefaultable()); - fMenuBar->UpdateMenu(); - fMenuBar->Update(); + _UpdateAll(); break; - case CTL_MARKED_MSG: - // This might not be the same for all keyboards - set_modifier_key(B_LEFT_COMMAND_KEY, 0x5c); - set_modifier_key(B_RIGHT_COMMAND_KEY, 0x60); - set_modifier_key(B_LEFT_CONTROL_KEY, 0x5d); - set_modifier_key(B_RIGHT_OPTION_KEY, 0x5f); - be_roster->Broadcast(new BMessage(B_MODIFIERS_CHANGED)); - - fRevertButton->SetEnabled(true); - fDefaultsButton->SetEnabled(settings->IsDefaultable()); - fMenuBar->Update(); + case CTL_MARKED_MSG: + fSettings->SetAltAsShortcut(false); + _UpdateAll(); break; case ALT_MARKED_MSG: - - // This might not be the same for all keyboards - set_modifier_key(B_LEFT_COMMAND_KEY, 0x5d); - set_modifier_key(B_RIGHT_COMMAND_KEY, 0x5f); - set_modifier_key(B_LEFT_CONTROL_KEY, 0x5c); - set_modifier_key(B_RIGHT_OPTION_KEY, 0x60); - - be_roster->Broadcast(new BMessage(B_MODIFIERS_CHANGED)); - - fRevertButton->SetEnabled(true); - fDefaultsButton->SetEnabled(settings->IsDefaultable()); - fMenuBar->Update(); + fSettings->SetAltAsShortcut(true); + _UpdateAll(); break; case COLOR_SCHEME_OPEN_MSG: @@ -170,10 +141,8 @@ fColorWindow = NULL; break; - case MENU_COLOR: - fRevertButton->SetEnabled(true); - fDefaultsButton->SetEnabled(settings->IsDefaultable()); - fMenuBar->Update(); + case MENU_COLOR: + _UpdateAll(); break; default: @@ -183,6 +152,15 @@ } +void +MenuWindow::_UpdateAll() +{ + fRevertButton->SetEnabled(fSettings->IsRevertable()); + fDefaultsButton->SetEnabled(fSettings->IsDefaultable()); + fMenuBar->Update(); +} + + bool MenuWindow::QuitRequested() { Modified: haiku/trunk/src/preferences/menu/MenuWindow.h =================================================================== --- haiku/trunk/src/preferences/menu/MenuWindow.h 2008-01-09 10:20:07 UTC (rev 23295) +++ haiku/trunk/src/preferences/menu/MenuWindow.h 2008-01-09 10:36:47 UTC (rev 23296) @@ -10,7 +10,7 @@ #ifndef MENU_WINDOW_H #define MENU_WINDOW_H - +#include "MenuSettings.h" #include #include @@ -20,16 +20,20 @@ class MenuBar; class MenuWindow : public BWindow { public: - MenuWindow(BRect frame); + MenuWindow(BRect frame); virtual void MessageReceived(BMessage *message); virtual bool QuitRequested(); - + + private: + void _UpdateAll(); + private: ColorWindow* fColorWindow; MenuBar* fMenuBar; BButton* fDefaultsButton; BButton* fRevertButton; + MenuSettings* fSettings; }; #endif // MENU_WINDOW_H From stippi at mail.berlios.de Wed Jan 9 12:05:41 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 9 Jan 2008 12:05:41 +0100 Subject: [Haiku-commits] r23297 - haiku/trunk/src/apps/aboutsystem Message-ID: <200801091105.m09B5f6u009304@sheep.berlios.de> Author: stippi Date: 2008-01-09 12:05:40 +0100 (Wed, 09 Jan 2008) New Revision: 23297 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23297&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: * added a few recent contributors... I probably forgot a few others who deserve to be mentioned... please speak up and I will correct it on the spot! :-) Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-01-09 10:36:47 UTC (rev 23296) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-01-09 11:05:40 UTC (rev 23297) @@ -375,6 +375,7 @@ "Stefano Ceccherini\n" "Rudolf Cornelissen\n" "J?r?me Duval\n" + "Julun\n" "Waldemar Kornewald\n" "Ryan Leavengood\n" "Michael Lotz\n" @@ -396,6 +397,7 @@ "Bruce Cameron\n" "Greg Crain\n" "Tyler Dauwalder\n" + "Alexandre Deckner\n" "Oliver Ruiz Dorantes\n" "John Drinkwater\n" "Cian Duffy\n" @@ -415,6 +417,7 @@ "Lubo? Kuli?\n" "Thomas Kurschel\n" "Elad Lahav\n" + "Anthony Lee\n" "Santiago Lema\n" "Oscar Lesta\n" "Jerome Leveque\n" From mmu_man at mail.berlios.de Wed Jan 9 12:12:16 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 9 Jan 2008 12:12:16 +0100 Subject: [Haiku-commits] r23298 - haiku/trunk/src/apps/codycam Message-ID: <200801091112.m09BCG5Y011752@sheep.berlios.de> Author: mmu_man Date: 2008-01-09 12:12:16 +0100 (Wed, 09 Jan 2008) New Revision: 23298 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23298&view=rev Modified: haiku/trunk/src/apps/codycam/FtpClient.cpp haiku/trunk/src/apps/codycam/FtpClient.h Log: Work around BeOS ftpd (sets 640) + robinhood (doesn't like 640) by adding Chmod() support. Modified: haiku/trunk/src/apps/codycam/FtpClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/FtpClient.cpp 2008-01-09 11:05:40 UTC (rev 23297) +++ haiku/trunk/src/apps/codycam/FtpClient.cpp 2008-01-09 11:12:16 UTC (rev 23298) @@ -245,6 +245,8 @@ if (rc) { _GetReply(replyString, code, codeType); rc = codeType <= 2; + // at least BeOS' ftpd forces 640 which RobinHood doesn't like... + Chmod(remote, "644"); } return rc; @@ -357,6 +359,31 @@ } +bool +FtpClient::Chmod(const string& path, const string& mod) +{ + bool rc = false; + int code, codeType; + string cmd = "SITE CHMOD ", replyString; + + cmd += mod; + cmd += " "; + cmd += path; + + if (path.length() == 0) + cmd += '/'; +printf("cmd: '%s'\n", cmd.c_str()); + if (_SendRequest(cmd) == true) { + if (_GetReply(replyString, code, codeType) == true) { +printf("reply: %d, %d\n", code, codeType); + if (codeType == 2) + rc = true; + } + } + return rc; +} + + void FtpClient::SetPassive(bool on) { Modified: haiku/trunk/src/apps/codycam/FtpClient.h =================================================================== --- haiku/trunk/src/apps/codycam/FtpClient.h 2008-01-09 11:05:40 UTC (rev 23297) +++ haiku/trunk/src/apps/codycam/FtpClient.h 2008-01-09 11:12:16 UTC (rev 23298) @@ -45,6 +45,7 @@ bool ChangeDir(const string& dir); bool PrintWorkingDir(string& dir); bool ListDirContents(string& listing); + bool Chmod(const string& path, const string& mod); void SetPassive(bool on); From mmu_man at mail.berlios.de Wed Jan 9 12:22:40 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 9 Jan 2008 12:22:40 +0100 Subject: [Haiku-commits] r23299 - haiku/trunk/src/apps/codycam Message-ID: <200801091122.m09BMeDY013748@sheep.berlios.de> Author: mmu_man Date: 2008-01-09 12:22:39 +0100 (Wed, 09 Jan 2008) New Revision: 23299 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23299&view=rev Added: haiku/trunk/src/apps/codycam/FileUploadClient.cpp haiku/trunk/src/apps/codycam/FileUploadClient.h Modified: haiku/trunk/src/apps/codycam/FtpClient.cpp haiku/trunk/src/apps/codycam/FtpClient.h haiku/trunk/src/apps/codycam/Jamfile Log: Add a base class for FtpClient to allow different clients later. Added: haiku/trunk/src/apps/codycam/FileUploadClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/FileUploadClient.cpp 2008-01-09 11:12:16 UTC (rev 23298) +++ haiku/trunk/src/apps/codycam/FileUploadClient.cpp 2008-01-09 11:22:39 UTC (rev 23299) @@ -0,0 +1,84 @@ +#include "FileUploadClient.h" + +FileUploadClient::FileUploadClient() +{ +} + + +FileUploadClient::~FileUploadClient() +{ +} + + +bool +FileUploadClient::ChangeDir(const string& dir) +{ + bool rc = false; + return rc; +} + + +bool +FileUploadClient::ListDirContents(string& listing) +{ + bool rc = false; + return rc; +} + + +bool +FileUploadClient::PrintWorkingDir(string& dir) +{ + bool rc = false; + return rc; +} + + +bool +FileUploadClient::Connect(const string& server, const string& login, const string& passwd) +{ + bool rc = false; + return rc; +} + + +bool +FileUploadClient::PutFile(const string& local, const string& remote, ftp_mode mode) +{ + bool rc = false; + return rc; +} + + +bool +FileUploadClient::GetFile(const string& remote, const string& local, ftp_mode mode) +{ + bool rc = false; + return rc; +} + + +// Note: this only works for local remote moves, cross filesystem moves +// will not work +bool +FileUploadClient::MoveFile(const string& oldPath, const string& newPath) +{ + bool rc = false; + return rc; +} + + +bool +FileUploadClient::Chmod(const string& path, const string& mod) +{ + bool rc = false; + return rc; +} + + +void +FileUploadClient::SetPassive(bool on) +{ +} + + Added: haiku/trunk/src/apps/codycam/FileUploadClient.h =================================================================== --- haiku/trunk/src/apps/codycam/FileUploadClient.h 2008-01-09 11:12:16 UTC (rev 23298) +++ haiku/trunk/src/apps/codycam/FileUploadClient.h 2008-01-09 11:22:39 UTC (rev 23299) @@ -0,0 +1,39 @@ +#ifndef FILE_UPLOAD_CLIENT_H +#define FILE_UPLOAD_CLIENT_H + + +#include +#include + +using std::string; + + +class FileUploadClient { + public: + FileUploadClient(); +virtual ~FileUploadClient(); + + enum ftp_mode { + binary_mode, + ascii_mode + }; + +virtual bool Connect(const string& server, const string& login, + const string& passwd); + +virtual bool PutFile(const string& local, const string& remote, + ftp_mode mode = binary_mode); + +virtual bool GetFile(const string& remote, const string& local, + ftp_mode mode = binary_mode); + +virtual bool MoveFile(const string& oldPath, const string& newPath); +virtual bool ChangeDir(const string& dir); +virtual bool PrintWorkingDir(string& dir); +virtual bool ListDirContents(string& listing); +virtual bool Chmod(const string& path, const string& mod); + +virtual void SetPassive(bool on); +}; + +#endif // FILE_UPLOAD_CLIENT_H Modified: haiku/trunk/src/apps/codycam/FtpClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/FtpClient.cpp 2008-01-09 11:12:16 UTC (rev 23298) +++ haiku/trunk/src/apps/codycam/FtpClient.cpp 2008-01-09 11:22:39 UTC (rev 23299) @@ -1,7 +1,7 @@ #include "FtpClient.h" FtpClient::FtpClient() - : + : FileUploadClient(), fState(0), fControl(NULL), fData(NULL) Modified: haiku/trunk/src/apps/codycam/FtpClient.h =================================================================== --- haiku/trunk/src/apps/codycam/FtpClient.h 2008-01-09 11:12:16 UTC (rev 23298) +++ haiku/trunk/src/apps/codycam/FtpClient.h 2008-01-09 11:22:39 UTC (rev 23299) @@ -7,6 +7,7 @@ #include #include +#include "FileUploadClient.h" using std::string; @@ -22,16 +23,11 @@ #define xEOF 236 -class FtpClient { +class FtpClient : public FileUploadClient { public: FtpClient(); ~FtpClient(); - enum ftp_mode { - binary_mode, - ascii_mode - }; - bool Connect(const string& server, const string& login, const string& passwd); Modified: haiku/trunk/src/apps/codycam/Jamfile =================================================================== --- haiku/trunk/src/apps/codycam/Jamfile 2008-01-09 11:12:16 UTC (rev 23298) +++ haiku/trunk/src/apps/codycam/Jamfile 2008-01-09 11:22:39 UTC (rev 23299) @@ -4,6 +4,7 @@ Application CodyCam : CodyCam.cpp + FileUploadClient.cpp FtpClient.cpp Settings.cpp SettingsHandler.cpp From stippi at mail.berlios.de Wed Jan 9 12:37:05 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 9 Jan 2008 12:37:05 +0100 Subject: [Haiku-commits] r23300 - haiku/trunk/src/servers/app Message-ID: <200801091137.m09Bb5u2031151@sheep.berlios.de> Author: stippi Date: 2008-01-09 12:37:05 +0100 (Wed, 09 Jan 2008) New Revision: 23300 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23300&view=rev Modified: haiku/trunk/src/servers/app/ViewLayer.cpp Log: * the change to support B_DRAW_ON_CHILDREN broke ViewLayer::ViewAt(), ie mouse events would not be passed to the correct children of views with B_DRAW_ON_CHILDREN flag set -> fixed. (fixes #1673) Modified: haiku/trunk/src/servers/app/ViewLayer.cpp =================================================================== --- haiku/trunk/src/servers/app/ViewLayer.cpp 2008-01-09 11:22:39 UTC (rev 23299) +++ haiku/trunk/src/servers/app/ViewLayer.cpp 2008-01-09 11:37:05 UTC (rev 23300) @@ -340,14 +340,27 @@ if (!fVisible) return NULL; - if (ScreenClipping(windowContentClipping).Contains(where)) - return this; + // NOTE: if this view can draw on children, it's screen clipping + // excludes these children, so we need to ask those first if they + // contain "where", otherwise we check the screen clipping before + // recursing into the children + if (!(fFlags & B_DRAW_ON_CHILDREN)) { + if (ScreenClipping(windowContentClipping).Contains(where)) + return this; + } + for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { ViewLayer* layer = child->ViewAt(where, windowContentClipping); if (layer) return layer; } + + if (fFlags & B_DRAW_ON_CHILDREN) { + if (ScreenClipping(windowContentClipping).Contains(where)) + return this; + } + return NULL; } From marcusoverhagen at mail.berlios.de Wed Jan 9 13:06:16 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 13:06:16 +0100 Subject: [Haiku-commits] r23301 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801091206.m09C6GTS005909@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 13:06:15 +0100 (Wed, 09 Jan 2008) New Revision: 23301 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23301&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/channels.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c Log: added more debug output Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/channels.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/channels.c 2008-01-09 11:37:05 UTC (rev 23300) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/channels.c 2008-01-09 12:06:15 UTC (rev 23301) @@ -20,7 +20,9 @@ #include +#define TRACE dprintf + /** called when an IDE channel was registered by a controller driver */ static status_t @@ -29,7 +31,7 @@ char *controller_name = NULL; uint32 channel_id; - SHOW_FLOW0(2, ""); + TRACE("ide_channel_added, parent is %p\n", parent); if (pnp->get_attr_string(parent, IDE_CONTROLLER_CONTROLLER_NAME_ITEM, &controller_name, true) != B_OK) { @@ -40,7 +42,7 @@ channel_id = pnp->create_id(IDE_CHANNEL_ID_GENERATOR); if (channel_id < 0) { - SHOW_ERROR(0, "Cannot register IDE controller %s - out of IDs", controller_name); + dprintf("Cannot register IDE controller %s - out of IDs", controller_name); goto err; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 11:37:05 UTC (rev 23300) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 12:06:15 UTC (rev 23301) @@ -32,6 +32,10 @@ #include #include +#define FLOW dprintf +#define TRACE dprintf + + scsi_for_sim_interface *scsi; fast_log_info *fast_log; @@ -92,7 +96,8 @@ //ide_request_priv *priv; // FAST_LOG3( bus->log, ev_ide_scsi_io, (uint32)request, request->target_id, request->target_lun ); - SHOW_FLOW(3, "%d:%d", request->target_id, request->target_lun); +// SHOW_FLOW(3, "%d:%d", request->target_id, request->target_lun); + FLOW("sim_scsi_iobus %p, %d:%d\n", bus, request->target_id, request->target_lun); if (bus->disconnected) goto err_disconnected; @@ -151,8 +156,7 @@ return; err_inv_device: - SHOW_ERROR(3, "Invalid device %d:%d", - request->target_id, request->target_lun); + FLOW("Invalid device %d:%d\n", request->target_id, request->target_lun); FAST_LOG1(bus->log, ev_ide_scsi_io_invalid_device, (uint32)request); request->subsys_status = SCSI_SEL_TIMEOUT; @@ -160,7 +164,7 @@ return; err_bus_busy: - SHOW_FLOW0(3, "Bus busy"); + FLOW("Bus busy\n"); FAST_LOG1(bus->log, ev_ide_scsi_io_bus_busy, (uint32)request); IDE_UNLOCK(bus); @@ -169,7 +173,7 @@ return; err_device_busy: - SHOW_FLOW0(3, "Device busy"); + FLOW("Device busy\n"); FAST_LOG1(bus->log, ev_ide_scsi_io_device_busy, (uint32)request); IDE_UNLOCK(bus); @@ -178,7 +182,7 @@ return; err_disconnected: - SHOW_ERROR0(3, "No controller anymore"); + TRACE("No controller anymore\n"); FAST_LOG1(bus->log, ev_ide_scsi_io_disconnected, (uint32)request); request->subsys_status = SCSI_NO_HBA; scsi->finished(request, 1); @@ -191,7 +195,7 @@ { char *controller_name; - SHOW_FLOW0(4, ""); + FLOW("sim_path_inquiry, bus %p\n", bus); if (bus->disconnected) return SCSI_NO_HBA; @@ -238,7 +242,7 @@ bool isAtapi; int i; - dprintf("ATA: scan_bus: bus %p\n", bus); + TRACE("ATA: scan_bus: bus %p\n", bus); if (bus->disconnected) return; @@ -260,13 +264,13 @@ } } - dprintf("ATA: scan_bus: bus %p finished\n", bus); + TRACE("ATA: scan_bus: bus %p finished\n", bus); } static uchar sim_rescan_bus(ide_bus_info *bus) { - dprintf("ATA: sim_rescan_bus\n"); + TRACE("ATA: sim_rescan_bus\n"); return SCSI_REQ_CMP; } @@ -548,7 +552,7 @@ bool dmaDisabled = false; status_t status; - SHOW_FLOW0(3, ""); + FLOW("ide_sim_init_bus, node %p\n", node); // first prepare the info structure bus = (ide_bus_info *)malloc(sizeof(*bus)); @@ -691,8 +695,11 @@ static status_t ide_sim_uninit_bus(ide_bus_info *bus) { - device_node_handle parent = pnp->get_parent(bus->node); + device_node_handle parent; + FLOW("ide_sim_uninit_bus: bus %p\n", bus); + + parent = pnp->get_parent(bus->node); pnp->uninit_driver(parent); pnp->put_device_node(parent); @@ -727,6 +734,8 @@ static void ide_sim_bus_removed(device_node_handle node, ide_bus_info *bus) { + FLOW("ide_sim_bus_removed\n"); + if (bus == NULL) // driver not loaded - no manual intervention needed return; @@ -747,6 +756,8 @@ { ide_device_info *device = bus->devices[target_id]; + FLOW("ide_sim_get_restrictions\n"); + // we declare even ATA devices as ATAPI so we have to emulate fewer // commands *is_atapi = true; From marcusoverhagen at mail.berlios.de Wed Jan 9 13:07:38 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 13:07:38 +0100 Subject: [Haiku-commits] r23302 - haiku/trunk/src/add-ons/kernel/generic/ide_adapter Message-ID: <200801091207.m09C7cB3007029@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 13:07:38 +0100 (Wed, 09 Jan 2008) New Revision: 23302 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23302&view=rev Modified: haiku/trunk/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c Log: added more debug output Modified: haiku/trunk/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c =================================================================== --- haiku/trunk/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c 2008-01-09 12:06:15 UTC (rev 23301) +++ haiku/trunk/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c 2008-01-09 12:07:38 UTC (rev 23302) @@ -334,6 +334,18 @@ TRACE("PCI-IDE: init channel...\n"); + if (1 /* debug */){ + uint8 bus, device, function; + uint16 vendorID, deviceID; + pnp->get_attr_uint16(node, PCI_DEVICE_BUS_ITEM, &bus, true); + pnp->get_attr_uint16(node, PCI_DEVICE_DEVICE_ITEM, &device, true); + pnp->get_attr_uint16(node, PCI_DEVICE_FUNCTION_ITEM, &function, true); + pnp->get_attr_uint16(node, PCI_DEVICE_VENDOR_ID_ITEM, &vendorID, true); + pnp->get_attr_uint16(node, PCI_DEVICE_DEVICE_ID_ITEM, &deviceID, true); + TRACE("PCI-IDE: bus %3d, device %2d, function %2d: vendor %04x, device %04x\n", + bus, device, function, vendorID, deviceID); + } + // get device data if (pnp->get_attr_uint16(node, IDE_ADAPTER_COMMAND_BLOCK_BASE, &command_block_base, false) != B_OK || pnp->get_attr_uint16(node, IDE_ADAPTER_CONTROL_BLOCK_BASE, &control_block_base, false) != B_OK @@ -350,6 +362,8 @@ goto err; } + TRACE("PCI-IDE: channel index %d\n", channel_index); + channel->node = node; channel->pci = controller->pci; channel->device = controller->device; From marcusoverhagen at mail.berlios.de Wed Jan 9 13:08:13 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 13:08:13 +0100 Subject: [Haiku-commits] r23303 - haiku/trunk/src/add-ons/kernel/busses/ide/silicon_image_3112 Message-ID: <200801091208.m09C8DEb007593@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 13:08:12 +0100 (Wed, 09 Jan 2008) New Revision: 23303 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23303&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/ide/silicon_image_3112/silicon_image_3112.c Log: added more debug output Modified: haiku/trunk/src/add-ons/kernel/busses/ide/silicon_image_3112/silicon_image_3112.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ide/silicon_image_3112/silicon_image_3112.c 2008-01-09 12:07:38 UTC (rev 23302) +++ haiku/trunk/src/add-ons/kernel/busses/ide/silicon_image_3112/silicon_image_3112.c 2008-01-09 12:08:12 UTC (rev 23303) @@ -467,13 +467,25 @@ if (!channel) return B_NO_MEMORY; - TRACE("channel %p\n", channel); - if (dm->get_attr_uint32(node, "silicon_image_3112/chan_index", &channelIndex, false) != B_OK) goto err; + if (1 /* debug */){ + uint8 bus, device, function; + uint16 vendorID, deviceID; + dm->get_attr_uint16(node, PCI_DEVICE_BUS_ITEM, &bus, true); + dm->get_attr_uint16(node, PCI_DEVICE_DEVICE_ITEM, &device, true); + dm->get_attr_uint16(node, PCI_DEVICE_FUNCTION_ITEM, &function, true); + dm->get_attr_uint16(node, PCI_DEVICE_VENDOR_ID_ITEM, &vendorID, true); + dm->get_attr_uint16(node, PCI_DEVICE_DEVICE_ID_ITEM, &deviceID, true); + TRACE("bus %3d, device %2d, function %2d: vendor %04x, device %04x\n", + bus, device, function, vendorID, deviceID); + } + TRACE("channel_index %ld\n", channelIndex); TRACE("channel name: %s\n", kControllerChannelData[channelIndex].name); + + TRACE("channel %p\n", channel); if (dm->init_driver(dm->get_parent(node), NULL, NULL, (void **)&controller) != B_OK) goto err; From mmu_man at mail.berlios.de Wed Jan 9 13:24:37 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 9 Jan 2008 13:24:37 +0100 Subject: [Haiku-commits] r23304 - haiku/trunk/src/apps/codycam Message-ID: <200801091224.m09COb0U007158@sheep.berlios.de> Author: mmu_man Date: 2008-01-09 13:24:37 +0100 (Wed, 09 Jan 2008) New Revision: 23304 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23304&view=rev Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp haiku/trunk/src/apps/codycam/CodyCam.h Log: Make sure the image format settings is saved. Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp =================================================================== --- haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-01-09 12:08:12 UTC (rev 23303) +++ haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-01-09 12:24:37 UTC (rev 23304) @@ -694,8 +694,12 @@ AddTranslationItems(fImageFormatMenu, B_TRANSLATOR_BITMAP); fImageFormatMenu->SetTargetForItems(this); - if (fImageFormatMenu->FindItem("JPEG Image") != NULL) + if (fImageFormatSettings->Value() && fImageFormatMenu->FindItem(fImageFormatSettings->Value()) != NULL) + fImageFormatMenu->FindItem(fImageFormatSettings->Value())->SetMarked(true); + else if (fImageFormatMenu->FindItem("JPEG Image") != NULL) fImageFormatMenu->FindItem("JPEG Image")->SetMarked(true); + else if (fImageFormatMenu->FindItem("JPEG image") != NULL) + fImageFormatMenu->FindItem("JPEG image")->SetMarked(true); else fImageFormatMenu->ItemAt(0)->SetMarked(true); @@ -833,6 +837,8 @@ fSettings->Add(fPassiveFtpSetting = new BooleanValueSetting("PassiveFtp", 1)); fSettings->Add(fFilenameSetting = new StringValueSetting("StillImageFilename", "codycam.jpg", "still image filename expected", "")); + fSettings->Add(fImageFormatSettings = new StringValueSetting("ImageFileFormat", + "JPEG Image", "image file format expected", "")); fSettings->Add(fCaptureRateSetting = new EnumeratedStringValueSetting("CaptureRate", "Every 5 minutes", kCaptureRate, "capture rate expected", "unrecognized capture rate specified")); @@ -850,6 +856,7 @@ fDirectorySetting->ValueChanged(fDirectory->Text()); fPassiveFtpSetting->ValueChanged(fPassiveFtp->Value()); fFilenameSetting->ValueChanged(fFileName->Text()); + fImageFormatSettings->ValueChanged(fImageFormatMenu->FindMarked()->Label()); fCaptureRateSetting->ValueChanged(fCaptureRateMenu->FindMarked()->Label()); fSettings->SaveSettings(); Modified: haiku/trunk/src/apps/codycam/CodyCam.h =================================================================== --- haiku/trunk/src/apps/codycam/CodyCam.h 2008-01-09 12:08:12 UTC (rev 23303) +++ haiku/trunk/src/apps/codycam/CodyCam.h 2008-01-09 12:24:37 UTC (rev 23304) @@ -153,6 +153,7 @@ StringValueSetting* fDirectorySetting; BooleanValueSetting* fPassiveFtpSetting; StringValueSetting* fFilenameSetting; + StringValueSetting* fImageFormatSettings; EnumeratedStringValueSetting* fCaptureRateSetting; }; From marcusoverhagen at mail.berlios.de Wed Jan 9 13:39:03 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 13:39:03 +0100 Subject: [Haiku-commits] r23305 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801091239.m09Cd3ec008489@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 13:39:03 +0100 (Wed, 09 Jan 2008) New Revision: 23305 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23305&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c Log: added more debug output, read device error register after a reset Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c 2008-01-09 12:24:37 UTC (rev 23304) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c 2008-01-09 12:39:03 UTC (rev 23305) @@ -87,17 +87,20 @@ // wait up to 31 seconds for busy to clear, abort when error is set status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); if (status != B_OK) { - if (status == B_TIMED_OUT) - dprintf("ATA: reset_bus: timeout\n"); - else - dprintf("ATA: reset_bus: error bit set\n"); + dprintf("ATA: reset_bus: timeout\n"); goto error; } if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | - ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) + ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high | ide_mask_error) != B_OK) goto error; + if (tf.read.error != 0x01 && tf.read.error != 0x81) + dprintf("ATA: device 0 failed, error code is 0x%02\n", tf.read.error); + + if (tf.read.error >= 0x80) + dprintf("ATA: device 0 indicates that device 1 failed, error code is 0x%02\n", tf.read.error); + *sigDev0 = tf.lba.sector_count; *sigDev0 |= ((uint32)tf.lba.lba_0_7) << 8; *sigDev0 |= ((uint32)tf.lba.lba_8_15) << 16; @@ -114,17 +117,17 @@ // wait up to 31 seconds for busy to clear, abort when error is set status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); if (status != B_OK) { - if (status == B_TIMED_OUT) - dprintf("ATA: reset_bus: timeout\n"); - else - dprintf("ATA: reset_bus: error bit set\n"); + dprintf("ATA: reset_bus: timeout\n"); goto error; } if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | - ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high) != B_OK) + ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high | ide_mask_error) != B_OK) goto error; + if (tf.read.error != 0x01) + dprintf("ATA: device 1 failed, error code is 0x%02\n", tf.read.error); + *sigDev1 = tf.lba.sector_count; *sigDev1 |= ((uint32)tf.lba.lba_0_7) << 8; *sigDev1 |= ((uint32)tf.lba.lba_8_15) << 16; From axeld at mail.berlios.de Wed Jan 9 14:42:05 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Jan 2008 14:42:05 +0100 Subject: [Haiku-commits] r23306 - haiku/trunk/src/apps/diskprobe Message-ID: <200801091342.m09Dg5Jb021127@sheep.berlios.de> Author: axeld Date: 2008-01-09 14:42:05 +0100 (Wed, 09 Jan 2008) New Revision: 23306 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23306&view=rev Modified: haiku/trunk/src/apps/diskprobe/AttributeEditors.cpp Log: Added a very simplistic BMessage viewer to the attribute editors - it should later be replaced by something more useful (when we have a usable column list/tree view class). Modified: haiku/trunk/src/apps/diskprobe/AttributeEditors.cpp =================================================================== --- haiku/trunk/src/apps/diskprobe/AttributeEditors.cpp 2008-01-09 12:39:03 UTC (rev 23305) +++ haiku/trunk/src/apps/diskprobe/AttributeEditors.cpp 2008-01-09 13:42:05 UTC (rev 23306) @@ -132,6 +132,28 @@ }; +class MessageView : public TypeEditorView { + public: + MessageView(BRect rect, DataEditor& editor); + virtual ~MessageView(); + + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); + virtual void MessageReceived(BMessage* message); + + virtual void CommitChanges(); + + void SetTo(BMessage& message); + + private: + BString _TypeToString(type_code type); + void _UpdateMessage(); + + DataEditor& fEditor; + BTextView* fTextView; +}; + + //----------------- @@ -142,7 +164,7 @@ SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); BStringView *stringView = new BStringView(BRect(5, 5, rect.right, 20), - B_EMPTY_STRING, "Contents:"); + B_EMPTY_STRING, "Contents:"); stringView->ResizeToPreferred(); AddChild(stringView); @@ -151,8 +173,9 @@ rect.right -= B_V_SCROLL_BAR_WIDTH; rect.bottom -= B_H_SCROLL_BAR_HEIGHT; - fTextView = new BTextView(rect, B_EMPTY_STRING, rect.OffsetToCopy(B_ORIGIN).InsetByCopy(5, 5), - B_FOLLOW_ALL, B_WILL_DRAW); + fTextView = new BTextView(rect, B_EMPTY_STRING, + rect.OffsetToCopy(B_ORIGIN).InsetByCopy(5, 5), + B_FOLLOW_ALL, B_WILL_DRAW); #if 0 char *data = (char *)malloc(info.size); @@ -164,7 +187,8 @@ } #endif - BScrollView *scrollView = new BScrollView("scroller", fTextView, B_FOLLOW_ALL, B_WILL_DRAW, true, true); + BScrollView *scrollView = new BScrollView("scroller", fTextView, + B_FOLLOW_ALL, B_WILL_DRAW, true, true); AddChild(scrollView); } @@ -1056,6 +1080,189 @@ } +// #pragma mark - MessageView + + +MessageView::MessageView(BRect rect, DataEditor &editor) + : TypeEditorView(rect, "Message View", B_FOLLOW_ALL, 0), + fEditor(editor) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + rect = Bounds().InsetByCopy(10, 10); + rect.right -= B_V_SCROLL_BAR_WIDTH; + rect.bottom -= B_H_SCROLL_BAR_HEIGHT; + + fTextView = new BTextView(rect, B_EMPTY_STRING, + rect.OffsetToCopy(B_ORIGIN).InsetByCopy(5, 5), + B_FOLLOW_ALL, B_WILL_DRAW); + fTextView->SetViewColor(ViewColor()); + fTextView->SetLowColor(ViewColor()); + + BScrollView *scrollView = new BScrollView("scroller", fTextView, + B_FOLLOW_ALL, B_WILL_DRAW, true, true); + AddChild(scrollView); +} + + +MessageView::~MessageView() +{ +} + + +BString +MessageView::_TypeToString(type_code type) +{ + // TODO: move this to a utility function (it's a copy from something + // similar in ProbeView.cpp) + char text[32]; + for (int32 i = 0; i < 4; i++) { + text[i] = type >> (24 - 8 * i); + if (text[i] < ' ' || text[i] == 0x7f) { + snprintf(text, sizeof(text), "0x%04lx", type); + break; + } else if (i == 3) + text[4] = '\0'; + } + + return BString(text); +} + + +void +MessageView::SetTo(BMessage& message) +{ + // TODO: when we have a real column list/tree view, redo this using + // it with nice editors as well. + + fTextView->SetText(""); + + char text[512]; + snprintf(text, sizeof(text), "what: '%.4s'\n\n", (char*)&message.what); + fTextView->Insert(text); + + type_code type; + int32 count; + char* name; + for (int32 i = 0; message.GetInfo(B_ANY_TYPE, i, &name, &type, &count) + == B_OK; i++) { + snprintf(text, sizeof(text), "%s\t", _TypeToString(type).String()); + fTextView->Insert(text); + + text_run_array array; + array.count = 1; + array.runs[0].offset = 0; + array.runs[0].font.SetFace(B_BOLD_FACE); + array.runs[0].color = (rgb_color){0, 0, 0, 255}; + + fTextView->Insert(name, &array); + + array.runs[0].font = be_plain_font; + fTextView->Insert("\n", &array); + + for (int32 j = 0; j < count; j++) { + const char* data; + ssize_t size; + if (message.FindData(name, type, j, (const void**)&data, &size) + != B_OK) + continue; + + text[0] = '\0'; + + switch (type) { + case B_INT64_TYPE: + snprintf(text, sizeof(text), "%Ld", *(int64*)data); + break; + case B_UINT64_TYPE: + snprintf(text, sizeof(text), "%Lu", *(uint64*)data); + break; + case B_INT32_TYPE: + snprintf(text, sizeof(text), "%ld", *(int32*)data); + break; + case B_UINT32_TYPE: + snprintf(text, sizeof(text), "%lu", *(uint32*)data); + break; + case B_BOOL_TYPE: + if (*(uint8*)data) + strcpy(text, "true"); + else + strcpy(text, "false"); + break; + case B_STRING_TYPE: + case B_MIME_STRING_TYPE: + { + snprintf(text, sizeof(text), "%s", data); + break; + } + } + + if (text[0]) { + fTextView->Insert("\t\t"); + if (count > 1) { + char index[16]; + snprintf(index, sizeof(index), "%ld.\t", j); + fTextView->Insert(index); + } + fTextView->Insert(text); + fTextView->Insert("\n"); + } + } + } +} + + +void +MessageView::_UpdateMessage() +{ + BAutolock locker(fEditor); + + size_t viewSize = fEditor.ViewSize(); + // that may need some more memory... + if (viewSize < fEditor.FileSize()) + fEditor.SetViewSize(fEditor.FileSize()); + + const char *buffer; + if (fEditor.GetViewBuffer((const uint8 **)&buffer) == B_OK) { + BMessage message; + message.Unflatten(buffer); + SetTo(message); + } + + // restore old view size + fEditor.SetViewSize(viewSize); +} + + +void +MessageView::AttachedToWindow() +{ + fEditor.StartWatching(this); + + _UpdateMessage(); +} + + +void +MessageView::DetachedFromWindow() +{ + fEditor.StopWatching(this); +} + + +void +MessageView::MessageReceived(BMessage* message) +{ + BView::MessageReceived(message); +} + + +void +MessageView::CommitChanges() +{ + // we're not an editor, we're just displaying something +} + + // #pragma mark - @@ -1084,10 +1291,12 @@ case B_OFF_T_TYPE: case B_POINTER_TYPE: return new NumberEditor(rect, editor); + case B_MESSAGE_TYPE: + // TODO: check for archived bitmaps!!! + return new MessageView(rect, editor); case B_MINI_ICON_TYPE: case B_LARGE_ICON_TYPE: case B_PNG_FORMAT: - case B_MESSAGE_TYPE: #ifdef HAIKU_TARGET_PLATFORM_HAIKU case B_VECTOR_ICON_TYPE: #endif From mmu_man at mail.berlios.de Wed Jan 9 15:10:37 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 9 Jan 2008 15:10:37 +0100 Subject: [Haiku-commits] r23307 - in haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam: . addons/sonix Message-ID: <200801091410.m09EAb5Y026412@sheep.berlios.de> Author: mmu_man Date: 2008-01-09 15:10:37 +0100 (Wed, 09 Jan 2008) New Revision: 23307 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23307&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDeframer.cpp haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDeframer.h haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.h haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Producer.cpp haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.h Log: Make CamFrame a subclass of BMallocIO to add a timestamp field. Set the field on allocation and pass it around. Still disabled as CodyCam drops everything, I should probably drop old frames from the buffer... for now it uses system_time() to make CodyCam happy. Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDeframer.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDeframer.cpp 2008-01-09 13:42:05 UTC (rev 23306) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDeframer.cpp 2008-01-09 14:10:37 UTC (rev 23307) @@ -108,7 +108,7 @@ if (!f) return ENOENT; *frame = f; - *stamp = 0LL; + *stamp = f->Stamp(); return B_OK; } Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDeframer.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDeframer.h 2008-01-09 13:42:05 UTC (rev 23306) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDeframer.h 2008-01-09 14:10:37 UTC (rev 23307) @@ -18,7 +18,14 @@ /* should have a real Frame class someday */ -#define CamFrame BMallocIO +class CamFrame : public BMallocIO +{ +public: + CamFrame() : BMallocIO() { fStamp = system_time(); }; +virtual ~CamFrame() {}; +bigtime_t Stamp() const { return fStamp; }; +bigtime_t fStamp; +}; class CamDeframer : public CamFilterInterface { Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp 2008-01-09 13:42:05 UTC (rev 23306) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp 2008-01-09 14:10:37 UTC (rev 23307) @@ -242,14 +242,14 @@ // ----------------------------------------------------------------------------- status_t -CamDevice::GetFrameBitmap(BBitmap **bm) +CamDevice::GetFrameBitmap(BBitmap **bm, bigtime_t *stamp) { return EINVAL; } // ----------------------------------------------------------------------------- status_t -CamDevice::FillFrameBuffer(BBuffer *buffer) +CamDevice::FillFrameBuffer(BBuffer *buffer, bigtime_t *stamp) { return EINVAL; } Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.h 2008-01-09 13:42:05 UTC (rev 23306) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.h 2008-01-09 14:10:37 UTC (rev 23307) @@ -66,8 +66,8 @@ // several ways to get raw frames virtual status_t WaitFrame(bigtime_t timeout); - virtual status_t GetFrameBitmap(BBitmap **bm); - virtual status_t FillFrameBuffer(BBuffer *buffer); + virtual status_t GetFrameBitmap(BBitmap **bm, bigtime_t *stamp=NULL); + virtual status_t FillFrameBuffer(BBuffer *buffer, bigtime_t *stamp=NULL); // locking bool Lock(); Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Producer.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Producer.cpp 2008-01-09 13:42:05 UTC (rev 23306) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Producer.cpp 2008-01-09 14:10:37 UTC (rev 23307) @@ -744,10 +744,12 @@ /* For a buffer originating from a device, you might want to calculate * this based on the PerformanceTimeFor the time your buffer arrived at * the hardware (plus any applicable adjustments). */ + /* h->start_time = fPerformanceTimeBase + (bigtime_t) ((fFrame - fFrameBase) * (1000000 / fConnectedFormat.field_rate)); + */ h->file_pos = 0; h->orig_size = 0; h->data_offset = 0; @@ -771,19 +773,24 @@ //NO! must be called without lock! //BAutolock lock(fCamDevice->Locker()); + bigtime_t stamp; //#ifdef UseFillFrameBuffer - err = fCamDevice->FillFrameBuffer(buffer); + err = fCamDevice->FillFrameBuffer(buffer, &stamp); if (err < B_OK) { ;//XXX handle error } //#endif #ifdef UseGetFrameBitmap BBitmap *bm; - err = fCamDevice->GetFrameBitmap(&bm); + err = fCamDevice->GetFrameBitmap(&bm, &stamp); if (err >= B_OK) { ;//XXX handle error } #endif + //PRINTF(1, ("FrameGenerator: stamp %Ld vs %Ld\n", stamp, h->start_time)); + //XXX: that's what we should be doing, but CodyCam drops all frames as they are late. (maybe add latency ??) + //h->start_time = TimeSource()->PerformanceTimeFor(stamp); + h->start_time = TimeSource()->PerformanceTimeFor(system_time()); PRINTF(1, ("FrameGenerator: SendBuffer...\n")); /* Send the buffer on down to the consumer */ Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp 2008-01-09 13:42:05 UTC (rev 23306) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp 2008-01-09 14:10:37 UTC (rev 23307) @@ -415,18 +415,17 @@ // ----------------------------------------------------------------------------- status_t -SonixCamDevice::GetFrameBitmap(BBitmap **bm) +SonixCamDevice::GetFrameBitmap(BBitmap **bm, bigtime_t *stamp=NULL) { BBitmap *b; CamFrame *f; - bigtime_t stamp; status_t err; PRINT((CH "()" CT)); err = fDeframer->WaitFrame(200000); if (err < B_OK) { PRINT((CH ": WaitFrame: %s" CT, strerror(err))); } if (err < B_OK) return err; - err = fDeframer->GetFrame(&f, &stamp); + err = fDeframer->GetFrame(&f, stamp); if (err < B_OK) { PRINT((CH ": GetFrame: %s" CT, strerror(err))); } if (err < B_OK) return err; @@ -446,10 +445,9 @@ // ----------------------------------------------------------------------------- status_t -SonixCamDevice::FillFrameBuffer(BBuffer *buffer) +SonixCamDevice::FillFrameBuffer(BBuffer *buffer, bigtime_t *stamp) { CamFrame *f; - bigtime_t stamp; status_t err; PRINT((CH "()" CT)); @@ -459,7 +457,7 @@ if (err < B_OK) return err; - err = fDeframer->GetFrame(&f, &stamp); + err = fDeframer->GetFrame(&f, stamp); if (err < B_OK) { PRINT((CH ": GetFrame: %s" CT, strerror(err))); } if (err < B_OK) return err; Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.h 2008-01-09 13:42:05 UTC (rev 23306) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.h 2008-01-09 14:10:37 UTC (rev 23307) @@ -68,8 +68,8 @@ virtual bool ValidateStartOfFrameTag(const uint8 *tag, size_t taglen); virtual bool ValidateEndOfFrameTag(const uint8 *tag, size_t taglen, size_t datalen); - virtual status_t GetFrameBitmap(BBitmap **bm); - virtual status_t FillFrameBuffer(BBuffer *buffer); + virtual status_t GetFrameBitmap(BBitmap **bm, bigtime_t *stamp=NULL); + virtual status_t FillFrameBuffer(BBuffer *buffer, bigtime_t *stamp=NULL); void DumpRegs(); From axeld at mail.berlios.de Wed Jan 9 15:29:15 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Jan 2008 15:29:15 +0100 Subject: [Haiku-commits] r23308 - haiku/trunk/src/apps/diskprobe Message-ID: <200801091429.m09ETFF1029292@sheep.berlios.de> Author: axeld Date: 2008-01-09 15:29:14 +0100 (Wed, 09 Jan 2008) New Revision: 23308 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23308&view=rev Added: haiku/trunk/src/apps/diskprobe/TypeEditors.cpp haiku/trunk/src/apps/diskprobe/TypeEditors.h Removed: haiku/trunk/src/apps/diskprobe/AttributeEditors.cpp haiku/trunk/src/apps/diskprobe/AttributeEditors.h Modified: haiku/trunk/src/apps/diskprobe/AttributeWindow.cpp haiku/trunk/src/apps/diskprobe/Jamfile Log: Renamed AttributeEditors.{cpp|h} to TypeEditors.{cpp|h}. Deleted: haiku/trunk/src/apps/diskprobe/AttributeEditors.cpp Deleted: haiku/trunk/src/apps/diskprobe/AttributeEditors.h Modified: haiku/trunk/src/apps/diskprobe/AttributeWindow.cpp =================================================================== --- haiku/trunk/src/apps/diskprobe/AttributeWindow.cpp 2008-01-09 14:10:37 UTC (rev 23307) +++ haiku/trunk/src/apps/diskprobe/AttributeWindow.cpp 2008-01-09 14:29:14 UTC (rev 23308) @@ -1,12 +1,12 @@ /* - * Copyright 2004-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ #include "AttributeWindow.h" -#include "AttributeEditors.h" #include "ProbeView.h" +#include "TypeEditors.h" #include #include Modified: haiku/trunk/src/apps/diskprobe/Jamfile =================================================================== --- haiku/trunk/src/apps/diskprobe/Jamfile 2008-01-09 14:10:37 UTC (rev 23307) +++ haiku/trunk/src/apps/diskprobe/Jamfile 2008-01-09 14:29:14 UTC (rev 23308) @@ -12,7 +12,7 @@ ProbeWindow.cpp FileWindow.cpp AttributeWindow.cpp - AttributeEditors.cpp + TypeEditors.cpp ProbeView.cpp OpenWindow.cpp FindWindow.cpp Copied: haiku/trunk/src/apps/diskprobe/TypeEditors.cpp (from rev 23306, haiku/trunk/src/apps/diskprobe/AttributeEditors.cpp) =================================================================== --- haiku/trunk/src/apps/diskprobe/AttributeEditors.cpp 2008-01-09 13:42:05 UTC (rev 23306) +++ haiku/trunk/src/apps/diskprobe/TypeEditors.cpp 2008-01-09 14:29:14 UTC (rev 23308) @@ -0,0 +1,1308 @@ +/* + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include "TypeEditors.h" +#include "DataEditor.h" + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +static const uint32 kMsgValueChanged = 'vlch'; +static const uint32 kMsgScaleChanged = 'scch'; +static const uint32 kMimeTypeItem = 'miti'; + + +class StringEditor : public TypeEditorView { + public: + StringEditor(BRect rect, DataEditor &editor); + + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); + virtual void MessageReceived(BMessage *message); + + void UpdateText(); + virtual void CommitChanges(); + + private: + DataEditor &fEditor; + BTextView *fTextView; + BString fPreviousText; +}; + + +class MimeTypeEditor : public TypeEditorView { + public: + MimeTypeEditor(BRect rect, DataEditor &editor); + + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); + virtual void MessageReceived(BMessage *message); + + void UpdateText(); + virtual void CommitChanges(); + + private: + DataEditor &fEditor; + BTextControl *fTextControl; + BString fPreviousText; +}; + + +class NumberEditor : public TypeEditorView { + public: + NumberEditor(BRect rect, DataEditor &editor); + + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); + virtual void MessageReceived(BMessage *message); + + void UpdateText(); + virtual void CommitChanges(); + + private: + const char *TypeLabel(); + status_t Format(char *buffer); + size_t Size(); + + DataEditor &fEditor; + BTextControl *fTextControl; + BString fPreviousText; +}; + + +class BooleanEditor : public TypeEditorView { + public: + BooleanEditor(BRect rect, DataEditor &editor); + + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); + virtual void MessageReceived(BMessage *message); + + void UpdateMenuField(); + virtual void CommitChanges(); + + private: + DataEditor &fEditor; + BMenuItem *fFalseMenuItem; + BMenuItem *fTrueMenuItem; +}; + + +class ImageView : public TypeEditorView { + public: + ImageView(BRect rect, DataEditor &editor); + virtual ~ImageView(); + + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); + virtual void MessageReceived(BMessage *message); + virtual void Draw(BRect updateRect); + + void UpdateImage(); + virtual void CommitChanges(); + + private: + DataEditor &fEditor; + BBitmap *fBitmap; + BStringView *fDescriptionView; + BSlider *fScaleSlider; +}; + + +class MessageView : public TypeEditorView { + public: + MessageView(BRect rect, DataEditor& editor); + virtual ~MessageView(); + + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); + virtual void MessageReceived(BMessage* message); + + virtual void CommitChanges(); + + void SetTo(BMessage& message); + + private: + BString _TypeToString(type_code type); + void _UpdateMessage(); + + DataEditor& fEditor; + BTextView* fTextView; +}; + + +//----------------- + + +StringEditor::StringEditor(BRect rect, DataEditor &editor) + : TypeEditorView(rect, "String Editor", B_FOLLOW_ALL, 0), + fEditor(editor) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + BStringView *stringView = new BStringView(BRect(5, 5, rect.right, 20), + B_EMPTY_STRING, "Contents:"); + stringView->ResizeToPreferred(); + AddChild(stringView); + + rect = Bounds(); + rect.top = stringView->Frame().bottom + 5; + rect.right -= B_V_SCROLL_BAR_WIDTH; + rect.bottom -= B_H_SCROLL_BAR_HEIGHT; + + fTextView = new BTextView(rect, B_EMPTY_STRING, + rect.OffsetToCopy(B_ORIGIN).InsetByCopy(5, 5), + B_FOLLOW_ALL, B_WILL_DRAW); + +#if 0 + char *data = (char *)malloc(info.size); + if (data != NULL) { + if (fNode.ReadAttr(attribute, info.type, 0LL, data, info.size) >= B_OK) + fTextView->SetText(data); + + free(data); + } +#endif + + BScrollView *scrollView = new BScrollView("scroller", fTextView, + B_FOLLOW_ALL, B_WILL_DRAW, true, true); + AddChild(scrollView); +} + + +void +StringEditor::UpdateText() +{ + BAutolock locker(fEditor); + + size_t viewSize = fEditor.ViewSize(); + // that may need some more memory... + if (viewSize < fEditor.FileSize()) + fEditor.SetViewSize(fEditor.FileSize()); + + const char *buffer; + if (fEditor.GetViewBuffer((const uint8 **)&buffer) == B_OK) { + fTextView->SetText(buffer); + fPreviousText.SetTo(buffer); + } + + // restore old view size + fEditor.SetViewSize(viewSize); +} + + +void +StringEditor::CommitChanges() +{ + if (fPreviousText != fTextView->Text()) { + fEditor.Replace(0, (const uint8 *)fTextView->Text(), + fTextView->TextLength() + 1); + } +} + + +void +StringEditor::AttachedToWindow() +{ + fEditor.StartWatching(this); + + UpdateText(); +} + + +void +StringEditor::DetachedFromWindow() +{ + fEditor.StopWatching(this); + + CommitChanges(); +} + + +void +StringEditor::MessageReceived(BMessage *message) +{ + BView::MessageReceived(message); +} + + +// #pragma mark - + + +MimeTypeEditor::MimeTypeEditor(BRect rect, DataEditor &editor) + : TypeEditorView(rect, "MIME Type Editor", B_FOLLOW_LEFT_RIGHT, 0), + fEditor(editor) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + fTextControl = new BTextControl(rect.InsetByCopy(5, 5), B_EMPTY_STRING, "MIME Type:", NULL, + new BMessage(kMsgValueChanged), B_FOLLOW_ALL); + fTextControl->SetDivider(StringWidth(fTextControl->Label()) + 8); + + float width, height; + fTextControl->GetPreferredSize(&width, &height); + fTextControl->ResizeTo(rect.Width() - 10, height); + + ResizeTo(rect.Width(), height + 10); + + AddChild(fTextControl); +} + + +void +MimeTypeEditor::UpdateText() +{ + BAutolock locker(fEditor); + + const char *mimeType; + if (fEditor.GetViewBuffer((const uint8 **)&mimeType) == B_OK) { + fTextControl->SetText(mimeType); + fPreviousText.SetTo(mimeType); + } +} + + +void +MimeTypeEditor::CommitChanges() +{ + if (fPreviousText != fTextControl->Text()) { + fEditor.Replace(0, (const uint8 *)fTextControl->Text(), + strlen(fTextControl->Text()) + 1); + } +} + + +void +MimeTypeEditor::AttachedToWindow() +{ + fTextControl->SetTarget(this); + fEditor.StartWatching(this); + + UpdateText(); +} + + +void +MimeTypeEditor::DetachedFromWindow() +{ + fEditor.StopWatching(this); + + CommitChanges(); +} + + +void +MimeTypeEditor::MessageReceived(BMessage *message) +{ + switch (message->what) { + case kMsgValueChanged: + fEditor.Replace(0, (const uint8 *)fTextControl->Text(), + strlen(fTextControl->Text()) + 1); + break; + + case kMsgDataEditorUpdate: + UpdateText(); + break; + + default: + BView::MessageReceived(message); + } +} + + +// #pragma mark - + + +NumberEditor::NumberEditor(BRect rect, DataEditor &editor) + : TypeEditorView(rect, "Number Editor", B_FOLLOW_LEFT_RIGHT, 0), + fEditor(editor) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + fTextControl = new BTextControl(rect.InsetByCopy(5, 5), B_EMPTY_STRING, TypeLabel(), NULL, + new BMessage(kMsgValueChanged), B_FOLLOW_ALL); + fTextControl->SetDivider(StringWidth(fTextControl->Label()) + 8); + fTextControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_RIGHT); + ResizeTo(rect.Width(), 30); + + AddChild(fTextControl); +} + + +void +NumberEditor::UpdateText() +{ + if (fEditor.Lock()) { + const char *number; + if (fEditor.GetViewBuffer((const uint8 **)&number) == B_OK) { + char buffer[64]; + char format[16]; + switch (fEditor.Type()) { + case B_FLOAT_TYPE: + { + float value = *(float *)number; + snprintf(buffer, sizeof(buffer), "%g", value); + break; + } + case B_DOUBLE_TYPE: + { + double value = *(double *)number; + snprintf(buffer, sizeof(buffer), "%g", value); + break; + } + case B_SSIZE_T_TYPE: + case B_INT8_TYPE: + case B_INT16_TYPE: + case B_INT32_TYPE: + case B_INT64_TYPE: + case B_OFF_T_TYPE: + { + Format(format); + switch (Size()) { + case 1: + { + int8 value = *(int8 *)number; + snprintf(buffer, sizeof(buffer), format, value); + break; + } + case 2: + { + int16 value = *(int16 *)number; + snprintf(buffer, sizeof(buffer), format, value); + break; + } + case 4: + { + int32 value = *(int32 *)number; + snprintf(buffer, sizeof(buffer), format, value); + break; + } + case 8: + { + int64 value = *(int64 *)number; + snprintf(buffer, sizeof(buffer), format, value); + break; + } + } + break; + } + default: + { + Format(format); + switch (Size()) { + case 1: + { + uint8 value = *(uint8 *)number; + snprintf(buffer, sizeof(buffer), format, value); + break; + } + case 2: + { + uint16 value = *(uint16 *)number; + snprintf(buffer, sizeof(buffer), format, value); + break; + } + case 4: + { + uint32 value = *(uint32 *)number; + snprintf(buffer, sizeof(buffer), format, value); + break; + } + case 8: + { + uint64 value = *(uint64 *)number; + snprintf(buffer, sizeof(buffer), format, value); + break; + } + } + break; + } + } + fTextControl->SetText(buffer); + fPreviousText.SetTo(buffer); + } + + fEditor.Unlock(); + } +} + + +void +NumberEditor::CommitChanges() +{ + if (fPreviousText == fTextControl->Text()) + return; + + const char *number = fTextControl->Text(); + uint8 buffer[8]; + + switch (fEditor.Type()) { + case B_FLOAT_TYPE: + { + float value = strtod(number, NULL); + *(float *)buffer = value; + break; + } + case B_DOUBLE_TYPE: + { + double value = strtod(number, NULL); + *(double *)buffer = value; + break; + } + case B_INT8_TYPE: + { + int64 value = strtoll(number, NULL, 0); + if (value > CHAR_MAX) + value = CHAR_MAX; + else if (value < CHAR_MIN) + value = CHAR_MIN; + *(int8 *)buffer = (int8)value; + break; + } + case B_UINT8_TYPE: + { + int64 value = strtoull(number, NULL, 0); + if (value > UCHAR_MAX) + value = UCHAR_MAX; + *(uint8 *)buffer = (uint8)value; + break; + } + case B_INT16_TYPE: + { + int64 value = strtoll(number, NULL, 0); + if (value > SHRT_MAX) + value = SHRT_MAX; + else if (value < SHRT_MIN) + value = SHRT_MIN; + *(int16 *)buffer = (int16)value; + break; + } + case B_UINT16_TYPE: + { + int64 value = strtoull(number, NULL, 0); + if (value > USHRT_MAX) + value = USHRT_MAX; + *(uint16 *)buffer = (uint16)value; + break; + } + case B_INT32_TYPE: + case B_SSIZE_T_TYPE: + { + int64 value = strtoll(number, NULL, 0); + if (value > LONG_MAX) + value = LONG_MAX; + else if (value < LONG_MIN) + value = LONG_MIN; + *(int32 *)buffer = (int32)value; + break; + } + case B_UINT32_TYPE: + case B_SIZE_T_TYPE: + case B_POINTER_TYPE: + { + uint64 value = strtoull(number, NULL, 0); + if (value > ULONG_MAX) + value = ULONG_MAX; + *(uint32 *)buffer = (uint32)value; + break; + } + case B_INT64_TYPE: + case B_OFF_T_TYPE: + { + int64 value = strtoll(number, NULL, 0); + *(int64 *)buffer = value; + break; + } + case B_UINT64_TYPE: + { + uint64 value = strtoull(number, NULL, 0); + *(uint64 *)buffer = value; + break; + } + default: + return; + } + + fEditor.Replace(0, buffer, Size()); + fPreviousText.SetTo((char *)buffer); +} + + +const char * +NumberEditor::TypeLabel() +{ + switch (fEditor.Type()) { + case B_INT8_TYPE: + return "8 Bit Signed Value:"; + case B_UINT8_TYPE: + return "8 Bit Unsigned Value:"; + case B_INT16_TYPE: + return "16 Bit Signed Value:"; + case B_UINT16_TYPE: + return "16 Bit Unsigned Value:"; + case B_INT32_TYPE: + return "32 Bit Signed Value:"; + case B_UINT32_TYPE: + return "32 Bit Unsigned Value:"; + case B_INT64_TYPE: + return "64 Bit Signed Value:"; + case B_UINT64_TYPE: + return "64 Bit Unsigned Value:"; + case B_FLOAT_TYPE: + return "Floating-Point Value:"; + case B_DOUBLE_TYPE: + return "Double Precision Floating-Point Value:"; + case B_SSIZE_T_TYPE: + return "32 Bit Size or Status:"; + case B_SIZE_T_TYPE: + return "32 Bit Unsigned Size:"; + case B_OFF_T_TYPE: + return "64 Bit Signed Offset:"; + case B_POINTER_TYPE: + return "32 Bit Unsigned Pointer:"; + default: + return "Number:"; + } +} + + +size_t +NumberEditor::Size() +{ + switch (fEditor.Type()) { + case B_INT8_TYPE: + return 1; + case B_UINT8_TYPE: + return 1; + case B_INT16_TYPE: + return 2; + case B_UINT16_TYPE: + return 2; + case B_SSIZE_T_TYPE: + case B_INT32_TYPE: + return 4; + case B_SIZE_T_TYPE: + case B_POINTER_TYPE: + case B_UINT32_TYPE: + return 4; + case B_INT64_TYPE: + case B_OFF_T_TYPE: + return 8; + case B_UINT64_TYPE: + return 8; + case B_FLOAT_TYPE: + return 4; + case B_DOUBLE_TYPE: + return 8; + default: + return 0; + } +} + + +status_t +NumberEditor::Format(char *buffer) +{ + switch (fEditor.Type()) { + case B_INT8_TYPE: + strcpy(buffer, "%hd"); + return B_OK; + case B_UINT8_TYPE: + strcpy(buffer, "%hu"); + return B_OK; + case B_INT16_TYPE: + strcpy(buffer, "%hd"); + return B_OK; + case B_UINT16_TYPE: + strcpy(buffer, "%hu"); + return B_OK; + case B_SSIZE_T_TYPE: + case B_INT32_TYPE: + strcpy(buffer, "%ld"); + return B_OK; + case B_SIZE_T_TYPE: + case B_POINTER_TYPE: + case B_UINT32_TYPE: + strcpy(buffer, "%lu"); + return B_OK; + case B_INT64_TYPE: + case B_OFF_T_TYPE: + strcpy(buffer, "%Ld"); + return B_OK; + case B_UINT64_TYPE: + strcpy(buffer, "%Lu"); + return B_OK; + case B_FLOAT_TYPE: + strcpy(buffer, "%g"); + return B_OK; + case B_DOUBLE_TYPE: + strcpy(buffer, "%lg"); + return B_OK; + + default: + return B_ERROR; + } +} + + +void +NumberEditor::AttachedToWindow() +{ + fTextControl->SetTarget(this); + fEditor.StartWatching(this); + + UpdateText(); +} + + +void +NumberEditor::DetachedFromWindow() +{ + fEditor.StopWatching(this); + + CommitChanges(); +} + + +void +NumberEditor::MessageReceived(BMessage *message) +{ + switch (message->what) { + case kMsgValueChanged: + CommitChanges(); + break; + case kMsgDataEditorUpdate: + UpdateText(); + break; + + default: + BView::MessageReceived(message); + } +} + + +// #pragma mark - + + +BooleanEditor::BooleanEditor(BRect rect, DataEditor &editor) + : TypeEditorView(rect, "Boolean Editor", B_FOLLOW_NONE, 0), + fEditor(editor) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + BPopUpMenu *menu = new BPopUpMenu("bool"); + BMessage *message; + menu->AddItem(fFalseMenuItem = new BMenuItem("false", new BMessage(kMsgValueChanged))); + menu->AddItem(fTrueMenuItem = new BMenuItem("true", message = new BMessage(kMsgValueChanged))); + message->AddInt8("value", 1); + + BMenuField *menuField = new BMenuField(rect.InsetByCopy(5, 5), B_EMPTY_STRING, + "Boolean Value:", menu, B_FOLLOW_LEFT_RIGHT); + menuField->SetDivider(StringWidth(menuField->Label()) + 8); + menuField->ResizeToPreferred(); + ResizeTo(menuField->Bounds().Width() + 10, menuField->Bounds().Height() + 10); + + UpdateMenuField(); + + AddChild(menuField); +} + + +void +BooleanEditor::UpdateMenuField() +{ + if (fEditor.Lock()) { + const char *buffer; + if (fEditor.GetViewBuffer((const uint8 **)&buffer) == B_OK) + (buffer[0] != 0 ? fTrueMenuItem : fFalseMenuItem)->SetMarked(true); + + fEditor.Unlock(); + } +} + + +void +BooleanEditor::CommitChanges() +{ + // we're commiting the changes as they happen +} + + +void +BooleanEditor::AttachedToWindow() +{ + fTrueMenuItem->SetTarget(this); + fFalseMenuItem->SetTarget(this); + + fEditor.StartWatching(this); +} + + +void +BooleanEditor::DetachedFromWindow() +{ + fEditor.StopWatching(this); +} + + +void +BooleanEditor::MessageReceived(BMessage *message) +{ + switch (message->what) { + case kMsgValueChanged: + { + uint8 boolean = message->FindInt8("value"); + fEditor.Replace(0, (const uint8 *)&boolean, 1); + break; + } + case kMsgDataEditorUpdate: + UpdateMenuField(); + break; + + default: + BView::MessageReceived(message); + } +} + + +// #pragma mark - + + +ImageView::ImageView(BRect rect, DataEditor &editor) + : TypeEditorView(rect, "Image View", B_FOLLOW_NONE, B_WILL_DRAW), + fEditor(editor), + fBitmap(NULL), + fScaleSlider(NULL) +{ + if (editor.Type() == B_MINI_ICON_TYPE || editor.Type() == B_LARGE_ICON_TYPE +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + || editor.Type() == B_VECTOR_ICON_TYPE +#endif + ) + SetName("Icon View"); + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + if (editor.Type() == B_VECTOR_ICON_TYPE) { + // vector icon + fScaleSlider = new BSlider(BRect(0, 0, 195, 20), "", NULL, + new BMessage(kMsgScaleChanged), 2, 32); + fScaleSlider->SetModificationMessage(new BMessage(kMsgScaleChanged)); + fScaleSlider->ResizeToPreferred(); + fScaleSlider->SetValue(8.0); + fScaleSlider->SetHashMarks(B_HASH_MARKS_BOTH); + fScaleSlider->SetHashMarkCount(15); + AddChild(fScaleSlider); + } +#endif + + fDescriptionView = new BStringView(Bounds(), "", "Could not read image", B_FOLLOW_NONE); + fDescriptionView->SetAlignment(B_ALIGN_CENTER); + + AddChild(fDescriptionView); +} + + +ImageView::~ImageView() +{ + delete fBitmap; +} + + +void +ImageView::AttachedToWindow() +{ + if (Parent() != NULL) + SetViewColor(Parent()->ViewColor()); + else + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + fEditor.StartWatching(this); + if (fScaleSlider != NULL) + fScaleSlider->SetTarget(this); + + UpdateImage(); +} + + +void +ImageView::DetachedFromWindow() +{ + fEditor.StopWatching(this); +} + + +void +ImageView::MessageReceived(BMessage *message) +{ + switch (message->what) { + case kMsgDataEditorUpdate: + UpdateImage(); + break; + + case kMsgScaleChanged: + UpdateImage(); + break; + + default: + BView::MessageReceived(message); + } +} + + +void +ImageView::Draw(BRect updateRect) +{ + if (fBitmap != NULL) { + SetDrawingMode(B_OP_ALPHA); + DrawBitmap(fBitmap, BPoint((Bounds().Width() - fBitmap->Bounds().Width()) / 2, 0)); + SetDrawingMode(B_OP_COPY); + } +} + + +void +ImageView::UpdateImage() +{ + // ToDo: add scroller if necessary?! + + BAutolock locker(fEditor); + + // we need all the data... + + size_t viewSize = fEditor.ViewSize(); + // that may need some more memory... + if (viewSize < fEditor.FileSize()) + fEditor.SetViewSize(fEditor.FileSize()); + + const char *data; + if (fEditor.GetViewBuffer((const uint8 **)&data) != B_OK) { + fEditor.SetViewSize(viewSize); + return; + } + + if (fBitmap != NULL && (fEditor.Type() == B_MINI_ICON_TYPE || fEditor.Type() == B_LARGE_ICON_TYPE)) { + // optimize icon update... + fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8); + fEditor.SetViewSize(viewSize); + return; + } +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + if (fBitmap != NULL && fEditor.Type() == B_VECTOR_ICON_TYPE + && fScaleSlider->Value() * 8 - 1 == fBitmap->Bounds().Width()) { + if (BIconUtils::GetVectorIcon((const uint8 *)data, + (size_t)fEditor.FileSize(), fBitmap) == B_OK) { + fEditor.SetViewSize(viewSize); + return; + } + } +#endif + + delete fBitmap; + fBitmap = NULL; + + switch (fEditor.Type()) { + case B_MINI_ICON_TYPE: + fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8); + if (fBitmap->InitCheck() == B_OK) + fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8); + break; + case B_LARGE_ICON_TYPE: + fBitmap = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8); + if (fBitmap->InitCheck() == B_OK) + fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8); + break; +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + case B_VECTOR_ICON_TYPE: + fBitmap = new BBitmap(BRect(0, 0, fScaleSlider->Value() * 8 - 1, + fScaleSlider->Value() * 8 - 1), B_RGB32); + if (fBitmap->InitCheck() != B_OK + || BIconUtils::GetVectorIcon((const uint8 *)data, + (size_t)fEditor.FileSize(), fBitmap) != B_OK) { + delete fBitmap; + fBitmap = NULL; + } + break; +#endif + case B_PNG_FORMAT: + { + BMemoryIO stream(data, fEditor.FileSize()); + fBitmap = BTranslationUtils::GetBitmap(&stream); + break; + } + case B_MESSAGE_TYPE: + { + BMessage message; [... truncated: 384 lines follow ...] From axeld at mail.berlios.de Wed Jan 9 15:56:50 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Jan 2008 15:56:50 +0100 Subject: [Haiku-commits] r23309 - haiku/trunk/src/system/kernel/vm Message-ID: <200801091456.m09EuomZ032333@sheep.berlios.de> Author: axeld Date: 2008-01-09 15:56:50 +0100 (Wed, 09 Jan 2008) New Revision: 23309 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23309&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp Log: The modified temporary page counter could go out of sync pretty easily. This could cause the page writer to run endlessly. Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-01-09 14:29:14 UTC (rev 23308) +++ haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-01-09 14:56:50 UTC (rev 23309) @@ -662,7 +662,8 @@ if (pageState != PAGE_STATE_INACTIVE && page->cache != NULL) panic("to be freed page %p has cache", page); - } else if (pageState == PAGE_STATE_MODIFIED && page->cache->temporary) + } + if (pageState == PAGE_STATE_MODIFIED && page->cache->temporary) sModifiedTemporaryPages++; else if (page->state == PAGE_STATE_MODIFIED && page->cache->temporary) sModifiedTemporaryPages--; @@ -682,6 +683,9 @@ } +/*! Moves a modified page into either the active or inactive page queue + depending on its usage count and wiring. +*/ static void move_page_to_active_or_inactive_queue(vm_page *page, bool dequeued) { From marcusoverhagen at mail.berlios.de Wed Jan 9 16:37:51 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 16:37:51 +0100 Subject: [Haiku-commits] r23310 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801091537.m09FbpTt004418@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 16:37:49 +0100 (Wed, 09 Jan 2008) New Revision: 23310 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23310&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/queuing.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c Log: removed command queuing and refactored device configuration Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 14:56:50 UTC (rev 23309) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 15:37:49 UTC (rev 23310) @@ -198,7 +198,6 @@ if (dma_success && !dev_err) { // reset error count if DMA worked device->DMA_failures = 0; - device->CQ_failures = 0; qrequest->request->data_resid = 0; finish_checksense(qrequest); } else { @@ -251,27 +250,6 @@ if (length > 0xffff) goto err; - if (qrequest->queuable) { - // queued LBA48 - device->tf_param_mask = ide_mask_features_48 - | ide_mask_sector_count - | ide_mask_LBA_low_48 - | ide_mask_LBA_mid_48 - | ide_mask_LBA_high_48; - - device->tf.queued48.sector_count_0_7 = length & 0xff; - device->tf.queued48.sector_count_8_15 = (length >> 8) & 0xff; - device->tf.queued48.tag = qrequest->tag; - device->tf.queued48.lba_0_7 = pos & 0xff; - device->tf.queued48.lba_8_15 = (pos >> 8) & 0xff; - device->tf.queued48.lba_16_23 = (pos >> 16) & 0xff; - device->tf.queued48.lba_24_31 = (pos >> 24) & 0xff; - device->tf.queued48.lba_32_39 = (pos >> 32) & 0xff; - device->tf.queued48.lba_40_47 = (pos >> 40) & 0xff; - device->tf.queued48.command = write ? IDE_CMD_WRITE_DMA_QUEUED - : IDE_CMD_READ_DMA_QUEUED; - return true; - } else { // non-queued LBA48 device->tf_param_mask = ide_mask_sector_count_48 | ide_mask_LBA_low_48 @@ -288,7 +266,6 @@ device->tf.lba48.lba_40_47 = (pos >> 40) & 0xff; device->tf.lba48.command = cmd_48[qrequest->uses_dma][write]; return true; - } } else { // normal LBA SHOW_FLOW0(3, "using LBA"); @@ -296,26 +273,6 @@ if (length > 0x100) goto err; - if (qrequest->queuable) { - // queued LBA - SHOW_FLOW( 3, "creating DMA queued command, tag=%d", qrequest->tag ); - device->tf_param_mask = ide_mask_features - | ide_mask_sector_count - | ide_mask_LBA_low - | ide_mask_LBA_mid - | ide_mask_LBA_high - | ide_mask_device_head; - - device->tf.queued.sector_count = length & 0xff; - device->tf.queued.tag = qrequest->tag; - device->tf.queued.lba_0_7 = pos & 0xff; - device->tf.queued.lba_8_15 = (pos >> 8) & 0xff; - device->tf.queued.lba_16_23 = (pos >> 16) & 0xff; - device->tf.queued.lba_24_27 = (pos >> 24) & 0xf; - device->tf.queued.command = write ? IDE_CMD_WRITE_DMA_QUEUED - : IDE_CMD_READ_DMA_QUEUED; - return true; - } else { // non-queued LBA SHOW_FLOW0( 3, "creating normal DMA/PIO command" ); device->tf_param_mask = ide_mask_sector_count @@ -331,7 +288,6 @@ device->tf.lba.lba_24_27 = (pos >> 24) & 0xf; device->tf.lba.command = cmd_28[qrequest->uses_dma][write]; return true; - } } } else { // CHS mode @@ -402,6 +358,7 @@ if (!prepare_dma(device, qrequest)) { // fall back to PIO on error +/* // if command queueing is used and there is another command // already running, we cannot fallback to PIO immediately -> declare // command as not queuable and resubmit it, so the scsi bus manager @@ -412,6 +369,7 @@ finish_retry(qrequest); return; } +*/ qrequest->uses_dma = false; } @@ -439,34 +397,7 @@ goto err_send; if (qrequest->uses_dma) { - // if queuing used, we have to ask device first whether it wants - // to postpone the command - // XXX: using the bus release IRQ we don't have to busy wait for - // a response, but I heard that IBM drives have problems with - // that IRQ; to be evaluated - if (qrequest->queuable) { - if (!wait_for_drdy(device)) - goto err_send; - if (check_rw_error(device, qrequest)) - goto err_send; - - if (device_released_bus(device)) { - // device enqueued command, so we have to wait; - // in access_finished, we'll ask device whether it wants to - // continue some other command - bus->active_qrequest = NULL; - - access_finished(bus, device); - // we may have rejected commands meanwhile, so tell - // the SIM that it can resend them now - scsi->cont_send_bus(bus->scsi_cookie); - return; - } - - //SHOW_ERROR0( 2, "device executes command instantly" ); - } - start_dma_wait_no_lock(device, qrequest); } else { // on PIO read, we start with waiting, on PIO write we can @@ -736,14 +667,11 @@ static bool -configure_command_queueing(ide_device_info *device) +disable_command_queueing(ide_device_info *device) { - device->CQ_enabled = device->CQ_supported = false; + if (!device->infoblock.DMA_QUEUED_supported) + return true; - if (!device->bus->can_CQ - || !device->infoblock.DMA_QUEUED_supported) - return initialize_qreq_array(device, 1); - if (device->infoblock.RELEASE_irq_supported && !device_set_feature( device, IDE_CMD_SET_FEATURES_DISABLE_REL_INT)) dprintf("Cannot disable release irq\n"); @@ -752,23 +680,18 @@ && !device_set_feature(device, IDE_CMD_SET_FEATURES_DISABLE_SERV_INT)) dprintf("Cannot disable service irq\n"); - device->CQ_enabled = device->CQ_supported = true; - - SHOW_INFO0(2, "Enabled command queueing"); - - // official IBM docs talk about 31 queue entries, though - // their disks report 32; let's hope their docs are wrong - return initialize_qreq_array(device, device->infoblock.queue_depth + 1); + return true; } -bool -prep_ata(ide_device_info *device) + +status_t +configure_ata_device(ide_device_info *device) { ide_device_infoblock *infoblock = &device->infoblock; uint32 chs_capacity; - SHOW_FLOW0(3, ""); + TRACE("configure_ata_device\n"); device->is_atapi = false; device->exec_io = ata_exec_io; @@ -780,12 +703,10 @@ // we merge it to "CFA bit set" for easier (later) testing if (*(uint16 *)infoblock == 0x848a) infoblock->CFA_supported = true; - else - return false; + else + return B_ERROR; } - SHOW_FLOW0(3, "1"); - if (!infoblock->_54_58_valid) { // normally, current_xxx contains active CHS mapping, // but if BIOS didn't call INITIALIZE DEVICE PARAMETERS @@ -820,25 +741,15 @@ if (device->use_48bits) device->total_sectors = infoblock->LBA48_total_sectors; - SHOW_FLOW0(3, "2"); - if (!configure_dma(device) - || !configure_command_queueing(device) + || !disable_command_queueing(device) || !configure_rmsn(device)) - return false; + return B_ERROR; - SHOW_FLOW0(3, "3"); - - return true; + return B_OK; } -void -enable_CQ(ide_device_info *device, bool enable) -{ -} - - status_t ata_read_infoblock(ide_device_info *device, bool isAtapi) { @@ -865,7 +776,7 @@ device->tf_param_mask = 0; device->tf.write.command = isAtapi ? IDE_CMD_IDENTIFY_PACKET_DEVICE : IDE_CMD_IDENTIFY_DEVICE; - if (!send_command(device, NULL, isAtapi ? false : true, 20, ide_state_sync_waiting)) { + if (!send_command(device, NULL, isAtapi ? false : true, 20, ide_state_accessing)) { TRACE("ata_read_infoblock: send_command failed\n"); goto error; } @@ -880,7 +791,7 @@ sizeof(device->infoblock) / sizeof(uint16), false); if (!wait_for_drqdown(device)) { - TRACE("scan_device_int: wait_for_drqdown failed\n"); + TRACE("ata_read_infoblock: wait_for_drqdown failed\n"); goto error; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-09 14:56:50 UTC (rev 23309) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-09 15:37:49 UTC (rev 23310) @@ -463,18 +463,18 @@ /*! Prepare device info for ATAPI device */ -bool -prep_atapi(ide_device_info *device) +status_t +configure_atapi_device(ide_device_info *device) { ide_device_infoblock *infoblock = &device->infoblock; - SHOW_FLOW0(3, ""); + dprintf("configure_atapi_device\n"); device->is_atapi = true; device->exec_io = atapi_exec_io; if (infoblock->_0.atapi.ATAPI != 2) - return false; + return B_ERROR; switch(infoblock->_0.atapi.drq_speed) { case 0: @@ -486,7 +486,7 @@ device->atapi.packet_irq_timeout = IDE_STD_TIMEOUT; break; default: - return false; + return B_ERROR; } SHOW_FLOW(3, "drq speed: %d", infoblock->_0.atapi.drq_speed); @@ -504,13 +504,8 @@ // (SCSI bus manager sets LUN there automatically) device->tf.packet.lun = 0; - if (!initialize_qreq_array(device, 1) - || !configure_dma(device)) - return false; + if (!configure_dma(device)) + return B_ERROR; - // currently, we don't support queuing, but I haven't found any - // ATAPI device that supports queuing anyway, so this is no loss - device->CQ_enabled = device->CQ_supported = false; - - return true; + return B_OK; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c 2008-01-09 14:56:50 UTC (rev 23309) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c 2008-01-09 15:37:49 UTC (rev 23310) @@ -96,10 +96,10 @@ goto error; if (tf.read.error != 0x01 && tf.read.error != 0x81) - dprintf("ATA: device 0 failed, error code is 0x%02\n", tf.read.error); + dprintf("ATA: device 0 failed, error code is 0x%02x\n", tf.read.error); if (tf.read.error >= 0x80) - dprintf("ATA: device 0 indicates that device 1 failed, error code is 0x%02\n", tf.read.error); + dprintf("ATA: device 0 indicates that device 1 failed, error code is 0x%02x\n", tf.read.error); *sigDev0 = tf.lba.sector_count; *sigDev0 |= ((uint32)tf.lba.lba_0_7) << 8; @@ -126,7 +126,7 @@ goto error; if (tf.read.error != 0x01) - dprintf("ATA: device 1 failed, error code is 0x%02\n", tf.read.error); + dprintf("ATA: device 1 failed, error code is 0x%02x\n", tf.read.error); *sigDev1 = tf.lba.sector_count; *sigDev1 |= ((uint32)tf.lba.lba_0_7) << 8; @@ -136,7 +136,7 @@ *sigDev1 = 0; } - dprintf("ATA: reset_bus success, device 0 signature: 0x%08lx, device 1 signature: 0x%08lx\n", *sigDev0, *sigDev1); + dprintf("ATA: reset_bus done\n"); return B_OK; @@ -370,99 +370,3 @@ } } - -/** tell device to continue queued command - * on return, no waiting is active! - * tag - will contain tag of command to be continued - * return: true - request continued - * false - something went wrong; sense set - */ - -bool -device_start_service(ide_device_info *device, int *tag) -{ - ide_bus_info *bus = device->bus; - - FAST_LOG1(bus->log, ev_ide_device_start_service, device->is_device1); - - device->tf.write.command = IDE_CMD_SERVICE; - device->tf.queued.mode = ide_mode_lba; - - if (bus->active_device != device) { - // don't apply any precautions in terms of IRQ - // -> the bus is in accessing state, so IRQs are ignored anyway - if (bus->controller->write_command_block_regs(bus->channel_cookie, - &device->tf, ide_mask_device_head) != B_OK) - // on error, pretend that this device asks for service - // -> the disappeared controller will be recognized soon ;) - return true; - - bus->active_device = device; - - // give one clock (400 ns) to take notice - spin(1); - } - - // here we go... - if (bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, - ide_mask_command) != B_OK) - goto err; - - // we need to wait for the device as we want to read the tag - if (!ide_wait(device, ide_status_drdy, ide_status_bsy, false, 1000000)) - return false; - - // read tag - if (bus->controller->read_command_block_regs(bus->channel_cookie, &device->tf, - ide_mask_sector_count) != B_OK) - goto err; - - if (device->tf.queued.release) { - // bus release is the wrong answer to a service request - set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_INTERNAL_FAILURE); - return false; - } - - *tag = device->tf.queued.tag; - - FAST_LOG2(bus->log, ev_ide_device_start_service2, device->is_device1, *tag); - return true; - -err: - set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_INTERNAL_FAILURE); - return false; -} - - -/** check device whether it wants to continue queued request */ - -bool -check_service_req(ide_device_info *device) -{ - ide_bus_info *bus = device->bus; - int status; - - // fast bailout if there is no request pending - if (device->num_running_reqs == 0) - return false; - - if (bus->active_device != device) { - // don't apply any precautions in terms of IRQ - // -> the bus is in accessing state, so IRQs are ignored anyway - if (bus->controller->write_command_block_regs(bus->channel_cookie, - &device->tf, ide_mask_device_head) != B_OK) - // on error, pretend that this device asks for service - // -> the disappeared controller will be recognized soon ;) - return true; - - bus->active_device = device; - - // give one clock (400 ns) to take notice - spin(1); - } - - status = bus->controller->get_altstatus(bus->channel_cookie); - - return (status & ide_status_service) != 0; -} - Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-09 14:56:50 UTC (rev 23309) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-09 15:37:49 UTC (rev 23310) @@ -56,16 +56,13 @@ // paranoia device->exec_io = NULL; - cancel_timer(&device->reconnect_timer.te); - scsi->free_dpc(device->reconnect_timeout_dpc); - cleanup_device_links(device); - destroy_qreq_array(device); - - uninit_synced_pc(&device->reconnect_timeout_synced_pc); - + if (device->qreqActive) + dprintf("destroy_device: Warning request still active\n"); + free(device->qreqFree); + free(device); } @@ -120,21 +117,18 @@ setup_device_links(bus, device); device->DMA_failures = 0; - device->CQ_failures = 0; device->num_failed_send = 0; device->combined_sense = 0; - device->num_running_reqs = 0; + device->qreqActive = NULL; + device->qreqFree = (ide_qrequest *)malloc(sizeof(ide_qrequest)); + memset(device->qreqFree, 0, sizeof(ide_qrequest)); + device->qreqFree->running = false; + device->qreqFree->device = device; + device->qreqFree->request = NULL; - device->reconnect_timer.device = device; - init_synced_pc(&device->reconnect_timeout_synced_pc, - reconnect_timeout_worker); - - if (scsi->alloc_dpc(&device->reconnect_timeout_dpc) != B_OK) - goto err; - device->total_sectors = 0; return device; @@ -200,3 +194,15 @@ prep_infoblock(device); return B_OK; } + + +status_t +configure_device(ide_device_info *device, bool isAtapi) +{ + dprintf("ATA: configure_device\n"); + + if (isAtapi) + return configure_atapi_device(device); + else + return configure_ata_device(device); +} Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-09 14:56:50 UTC (rev 23309) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-09 15:37:49 UTC (rev 23310) @@ -91,18 +91,13 @@ uint8 use_LBA : 1; // true for LBA, false for CHS uint8 use_48bits : 1; // true for LBA48 uint8 is_atapi : 1; // true for ATAPI, false for ATA - uint8 CQ_supported : 1; // Command Queuing supported - uint8 CQ_enabled : 1; // Command Queuing enabled uint8 DMA_supported : 1; // DMA supported uint8 DMA_enabled : 1; // DMA enabled uint8 is_device1 : 1; // true for slave, false for master - uint8 queue_depth; // maximum Command Queueing depth - uint8 last_lun; // last LUN uint8 DMA_failures; // DMA failures in a row - uint8 CQ_failures; // Command Queuing failures during _last_ command uint8 num_failed_send; // number of consequetive send problems // next two error codes are copied to request on finish_request & co. @@ -112,9 +107,8 @@ // pending error codes uint32 combined_sense; // emulated sense of device - struct ide_qrequest *qreq_array; // array of ide requests - struct ide_qrequest *free_qrequests; // free list - int num_running_reqs; // number of running requests + struct ide_qrequest *qreqActive; + struct ide_qrequest *qreqFree; struct ide_device_info *other_device; // other device on same bus @@ -139,11 +133,6 @@ uint8 device_type; // atapi device type - bool reconnect_timer_installed; // true, if reconnect timer is running - ide_device_timer_info reconnect_timer; // reconnect timeout - scsi_dpc_cookie reconnect_timeout_dpc; // dpc fired by timeout - ide_synced_pc reconnect_timeout_synced_pc; // spc fired by dpc - // pio from here on int left_sg_elem; // remaining sg elements const physical_entry *cur_sg_elem; // active sg element @@ -175,8 +164,6 @@ uint8 running : 1; // true if "on bus" uint8 uses_dma : 1; // true if using dma uint8 packet_irq : 1; // true if waiting for command packet irq - uint8 queuable : 1; // true if command queuing is used - uint8 tag; // command queuing tag } ide_qrequest; @@ -323,8 +310,6 @@ bool check_rw_error(ide_device_info *device, ide_qrequest *qrequest); bool check_output(ide_device_info *device, bool drdy_required, int error_mask, bool is_write); -bool prep_ata(ide_device_info *device); -void enable_CQ(ide_device_info *device, bool enable); void ata_send_rw(ide_device_info *device, ide_qrequest *qrequest, uint64 pos, size_t length, bool write); @@ -335,11 +320,10 @@ status_t ata_read_infoblock(ide_device_info *device, bool isAtapi); +status_t configure_ata_device(ide_device_info *device); // atapi.c - -bool prep_atapi(ide_device_info *device); - +status_t configure_atapi_device(ide_device_info *device); void send_packet(ide_device_info *device, ide_qrequest *qrequest, bool write); void packet_dpc(ide_qrequest *qrequest); void atapi_exec_io(ide_device_info *device, ide_qrequest *qrequest); @@ -359,7 +343,6 @@ // timeout in seconds bool send_command(ide_device_info *device, ide_qrequest *qrequest, bool need_drdy, uint32 timeout, ide_bus_state new_state); -bool device_start_service( ide_device_info *device, int *tag); //bool reset_device(ide_device_info *device, ide_qrequest *ignore); //bool reset_bus(ide_device_info *device, ide_qrequest *ignore); @@ -379,8 +362,8 @@ void destroy_device(ide_device_info *device); ide_device_info *create_device(ide_bus_info *bus, bool is_device1); +status_t configure_device(ide_device_info *device, bool isAtapi); - // dma.c bool prepare_dma(ide_device_info *device, ide_qrequest *qrequest); @@ -407,18 +390,7 @@ status_t write_PIO_block(ide_qrequest *qrequest, int length); -// queuing.c -bool send_abort_queue(ide_device_info *device); -bool try_service(ide_device_info *device); - -void reconnect_timeout_worker(ide_bus_info *bus, void *arg); -int32 reconnect_timeout(timer *arg); - -bool initialize_qreq_array(ide_device_info *device, int queue_depth); -void destroy_qreq_array(ide_device_info *device); - - // sync.c // timeout in seconds (according to CAM) Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 14:56:50 UTC (rev 23309) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 15:37:49 UTC (rev 23310) @@ -78,20 +78,10 @@ static void set_check_condition(ide_qrequest *qrequest); -/** check whether this request can be within device */ - -static inline bool -is_queuable(ide_device_info *device, scsi_ccb *request) -{ - return false; -} - - static void sim_scsi_io(ide_bus_info *bus, scsi_ccb *request) { ide_device_info *device; - bool queuable; ide_qrequest *qrequest; //ide_request_priv *priv; @@ -116,8 +106,6 @@ if (request->target_lun > device->last_lun) goto err_inv_device; - queuable = is_queuable(device, request); - // grab the bus ACQUIRE_BEN(&bus->status_report_ben); IDE_LOCK(bus); @@ -126,27 +114,26 @@ goto err_bus_busy; // bail out if device can't accept further requests - if (device->free_qrequests == NULL - || (device->num_running_reqs > 0 && !queuable)) + if (device->qreqFree == NULL) goto err_device_busy; bus->state = ide_state_accessing; + ++bus->num_running_reqs; + IDE_UNLOCK(bus); RELEASE_BEN(&bus->status_report_ben); // as we own the bus, noone can bother us - qrequest = device->free_qrequests; - device->free_qrequests = qrequest->next; + qrequest = device->qreqFree; + device->qreqFree = NULL; + device->qreqActive = qrequest; qrequest->request = request; - qrequest->queuable = queuable; qrequest->running = true; qrequest->uses_dma = false; - ++device->num_running_reqs; - ++bus->num_running_reqs; - bus->active_qrequest = qrequest; + bus->active_qrequest = qrequest; // XXX whats this!?!?! FAST_LOGN(bus->log, ev_ide_scsi_io_exec, 4, (uint32)qrequest, (uint32)request, bus->num_running_reqs, device->num_running_reqs); @@ -247,21 +234,33 @@ if (bus->disconnected) return; - status = reset_bus(bus, &devicePresent[0], &deviceSignature[0], &devicePresent[1], &deviceSignature[1]); - for (i = 0; i < bus->max_devices; ++i) { if (bus->devices[i]) destroy_device(bus->devices[i]); + } - if (status == B_OK && devicePresent[i]) { - isAtapi = deviceSignature[i] == 0xeb140101; - dprintf("ATA: scan_bus: bus %p, creating device %d\n", bus, i); - device = create_device(bus, i /* isDevice1 */); - if (scan_device(device, isAtapi) != B_OK) { - dprintf("ATA: scan_bus: bus %p, scanning failed, destroying device %d\n", bus, i); - destroy_device(device); - } + status = reset_bus(bus, &devicePresent[0], &deviceSignature[0], &devicePresent[1], &deviceSignature[1]); + + for (i = 0; i < bus->max_devices; ++i) { + if (!devicePresent[i]) + continue; + + isAtapi = deviceSignature[i] == 0xeb140101; + + dprintf("ATA: scan_bus: bus %p, creating device %d, signature is 0x%08lx\n", + bus, i, deviceSignature[i]); + + device = create_device(bus, i /* isDevice1 */); + + if (scan_device(device, isAtapi) != B_OK) { + dprintf("ATA: scan_bus: bus %p, scanning failed, destroying device %d\n", bus, i); + destroy_device(device); + continue; } + if (configure_device(device, isAtapi) != B_OK) { + dprintf("ATA: scan_bus: bus %p, configure failed, destroying device %d\n", bus, i); + destroy_device(device); + } } TRACE("ATA: scan_bus: bus %p finished\n", bus); @@ -370,7 +369,6 @@ ide_device_info *device = qrequest->device; ide_bus_info *bus = device->bus; scsi_ccb *request; - uint num_running; FAST_LOG2(bus->log, ev_ide_finish_request, (uint32)qrequest, resubmit); SHOW_FLOW0(3, ""); @@ -380,14 +378,12 @@ request = qrequest->request; qrequest->running = false; - qrequest->next = device->free_qrequests; - device->free_qrequests = qrequest; - // num_running is not really correct as the XPT is interested - // in the number of concurrent requests when it was *started* ! - num_running = device->num_running_reqs--; - --bus->num_running_reqs; + device->qreqFree = device->qreqActive; + device->qreqActive = NULL; + --bus->num_running_reqs; // XXX borked!!! + // paranoia bus->active_qrequest = NULL; @@ -405,7 +401,7 @@ if (resubmit) scsi->resubmit(request); else - scsi->finished(request, num_running); + scsi->finished(request, 1); RELEASE_BEN(&bus->status_report_ben); } @@ -472,7 +468,7 @@ scsi->block_bus(bus->scsi_cookie); finish_checksense(qrequest); - send_abort_queue(qrequest->device); +// send_abort_queue(qrequest->device); // XXX fix this scsi->unblock_bus(bus->scsi_cookie); } @@ -487,17 +483,15 @@ { ide_device_info *device = qrequest->device; ide_bus_info *bus = device->bus; - uint num_requests; FAST_LOG2(bus->log, ev_ide_finish_norelease, (uint32)qrequest, resubmit); qrequest->running = false; - qrequest->next = device->free_qrequests; - device->free_qrequests = qrequest; - num_requests = device->num_running_reqs++; - --bus->num_running_reqs; + device->qreqFree = device->qreqActive; + device->qreqActive = 0; + if (bus->active_qrequest == qrequest) bus->active_qrequest = NULL; @@ -506,7 +500,7 @@ if (resubmit) scsi->resubmit(qrequest->request); else - scsi->finished(qrequest->request, num_requests); + scsi->finished(qrequest->request, 1); RELEASE_BEN(&bus->status_report_ben); } @@ -531,6 +525,8 @@ // the entire bus instead (it won't take that long anyway) scsi->block_bus(device->bus->scsi_cookie); + // XXX fix this +/* for (i = 0; i < device->queue_depth; ++i) { ide_qrequest *qrequest = &device->qreq_array[i]; @@ -539,7 +535,7 @@ finish_norelease(qrequest, resubmit); } } - +*/ scsi->unblock_bus(device->bus->scsi_cookie); } @@ -635,22 +631,6 @@ SHOW_FLOW(2, "can_dma: %d", bus->can_DMA); - if (bus->can_DMA) { - if (pnp->get_attr_uint8(node, IDE_CONTROLLER_CAN_CQ_ITEM, &bus->can_CQ, true) != B_OK) { - // per default, command queuing is supported unless the driver - // reports problems (queuing should be transparent to - // controller, but for sure there is some buggy, over-optimizing - // controller out there) - bus->can_CQ = true; - } - } else { - // I am not sure if it's a problem of the driver or the drive (probably the - // former), but we're generally disabling command queueing in case of PIO - // transfers. Since those should be rare on a real system (as is CQ support - // in the drive), it's not really worth investigating, though. - bus->can_CQ = false; - } - parent = pnp->get_parent(node); status = pnp->init_driver(parent, bus, (driver_module_info **)&bus->controller, Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/queuing.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/queuing.c 2008-01-09 14:56:50 UTC (rev 23309) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/queuing.c 2008-01-09 15:37:49 UTC (rev 23310) @@ -21,308 +21,8 @@ #define MAX_CQ_FAILURES 3 -/** convert tag to request */ -static inline ide_qrequest * -tag2request(ide_device_info *device, int tag) -{ - ide_qrequest *qrequest = &device->qreq_array[tag]; - if (qrequest->running) - return qrequest; - - return NULL; -} - - -/** service device - * - * (expects locked bus and bus in "accessing" state) - * returns true if servicing a command (implies having bus unlocked) - * returns false on error - */ - -static bool -service_device(ide_device_info *device) -{ - ide_qrequest *qrequest; - int tag; - - SHOW_FLOW0( 3, "Start servicing" ); - - // delete timeout first - - // we must unlock bus before cancelling timer: if the timeout has - // just been fired we have to wait for it, but in turn it waits - // for the ide bus -> deadlock - IDE_UNLOCK(device->bus); - - cancel_timer(&device->reconnect_timer.te); - - // between IDE_UNLOCK and cancel_timer the request may got - // discarded due to timeout, so it's not a hardware problem - // if servicing fails - - // further, the device discards the entire queue if anything goes - // wrong, thus we call send_abort_queue on each error - // (we could also discard the queue without telling the device, - // but we prefer setting the device into a safe state) - - // ask device to continue - if (!device_start_service(device, &tag)) { - send_abort_queue(device); - goto err; - } - - SHOW_FLOW0( 3, "device starts service" ); - - // get tag of request - qrequest = tag2request(device, tag); - if (qrequest == NULL) { - send_abort_queue(device); - goto err; - } - - SHOW_FLOW( 3, "continue request %p with tag %d", qrequest, tag ); - - device->bus->active_qrequest = qrequest; - - // from here on, queuing is ATA read/write specific, so you have to - // modify that if you want to support ATAPI queuing! - if (check_rw_error(device, qrequest)) { - // if a read/write error occured, the request really failed - finish_reset_queue(qrequest); - goto err; - } - - // all ATA commands continue with a DMA request - if (!prepare_dma(device, qrequest)) { - // this is effectively impossible: before the command was initially - // sent, prepare_dma had been called and obviously didn't fail, - // so why should it fail now? - device->subsys_status = SCSI_HBA_ERR; - finish_reset_queue(qrequest); - goto err; - } - - SHOW_FLOW0( 3, "launch DMA" ); - - start_dma_wait_no_lock(device, qrequest); - - return true; - -err: - // don't start timeout - all requests have been discarded at this point - IDE_LOCK(device->bus); - return false; -} - - -/** check if some device on bus wants to continue queued requests; - * - * (expects locked bus and bus in "accessing" state) - * returns true if servicing a command (implies having bus unlocked) - * returns false if nothing to service - */ - -bool -try_service(ide_device_info *device) -{ - bool this_device_needs_service; - ide_device_info *other_device; - - other_device = device->other_device; - - // first check whether current device requests service - // (the current device is selected anyway, so asking it is fast) - this_device_needs_service = check_service_req(device); - - // service other device first as it was certainly waiting - // longer then the current device - if (other_device != device && check_service_req(other_device)) { - if (service_device(other_device)) { - // we handed over control; start timeout for device - // (see below about fairness) - if (device->num_running_reqs > 0) { - if (!device->reconnect_timer_installed) { - device->reconnect_timer_installed = true; - add_timer(&device->reconnect_timer.te, reconnect_timeout, - IDE_RELEASE_TIMEOUT, B_ONE_SHOT_RELATIVE_TIMER); - } - } - return true; - } - } - - // service our device second - if (this_device_needs_service) { - if (service_device(device)) - return true; - } - - // if device has pending reqs, start timeout. - // this may sound strange as we cannot be blamed if the [... truncated: 213 lines follow ...] From colacoder at mail.berlios.de Wed Jan 9 16:42:54 2008 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Wed, 9 Jan 2008 16:42:54 +0100 Subject: [Haiku-commits] r23311 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200801091542.m09FgsPk004798@sheep.berlios.de> Author: colacoder Date: 2008-01-09 16:42:54 +0100 (Wed, 09 Jan 2008) New Revision: 23311 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23311&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.c Log: [HDA] Pass correct Cyclic Buffer Length to hardware... Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.c 2008-01-09 15:37:49 UTC (rev 23310) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.c 2008-01-09 15:42:54 UTC (rev 23311) @@ -219,7 +219,7 @@ OREG32(afg->codec->ctrlr,s->off,BDPL) = s->bdl_pa; OREG32(afg->codec->ctrlr,s->off,BDPU) = 0; OREG16(afg->codec->ctrlr,s->off,LVI) = s->num_buffers -1; - OREG32(afg->codec->ctrlr,s->off,CBL) = s->num_channels * s->num_buffers; + OREG32(afg->codec->ctrlr,s->off,CBL) = s->sample_size * s->num_channels * s->num_buffers * s->buffer_length; /* total cyclic buffer size in _bytes_ */ OREG8(afg->codec->ctrlr,s->off,CTL0) = CTL0_IOCE | CTL0_FEIE | CTL0_DEIE; OREG8(afg->codec->ctrlr,s->off,CTL2) = s->id << 4; @@ -227,7 +227,7 @@ verb[1] = MAKE_VERB(afg->codec->addr, s->io_wid, VID_SET_CVTSTRCHN, s->id << 4); rc = hda_send_verbs(afg->codec, verb, response, 2); - return rc; + return rc; } //#pragma mark - From fekdahl at gmail.com Wed Jan 9 18:18:42 2008 From: fekdahl at gmail.com (Fredrik Ekdahl) Date: Wed, 09 Jan 2008 18:18:42 +0100 Subject: [Haiku-commits] r23296 - haiku/trunk/src/preferences/menu In-Reply-To: <200801091036.m09Aalu4007539@sheep.berlios.de> References: <200801091036.m09Aalu4007539@sheep.berlios.de> Message-ID: <1199899122.6152.1.camel@ekdahl> ons 2008-01-09 klockan 11:36 +0100 skrev stippi at BerliOS: > Author: stippi > Date: 2008-01-09 11:36:47 +0100 (Wed, 09 Jan 2008) > New Revision: 23296 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23296&view=rev > > Modified: > haiku/trunk/src/preferences/menu/ColorWindow.cpp > haiku/trunk/src/preferences/menu/ColorWindow.h > haiku/trunk/src/preferences/menu/MenuBar.cpp > haiku/trunk/src/preferences/menu/MenuBar.h > haiku/trunk/src/preferences/menu/MenuSettings.cpp > haiku/trunk/src/preferences/menu/MenuSettings.h > haiku/trunk/src/preferences/menu/MenuWindow.cpp > haiku/trunk/src/preferences/menu/MenuWindow.h > Log: > applied patch by aldeck: > * the Revert button always returns to the settings which were active > when the preflet was started > * the Defaults button always applies the default settings (the Revert > button then still reverts to the original settings instead of those > which were active when "Defaults" was pressed) > * the enabled state of the two buttons is correctly maintained > * code cleanup and refactoring > Build is broken since this change: C++ generated/objects/haiku/x86/release/preferences/menu/MenuSettings.o src/preferences/menu/MenuSettings.cpp: In member function 'bool MenuSettings::IsDefaultable()': src/preferences/menu/MenuSettings.cpp:156: error: 'strcmp' was not declared in this scope src/preferences/menu/MenuSettings.cpp: In member function 'bool MenuSettings::IsRevertable()': src/preferences/menu/MenuSettings.cpp:173: error: 'strcmp' was not declared in this scope /media/data/develop/haiku/trunk/generated/cross-tools/bin/i586-pc-haiku-gcc -c "src/preferences/menu/MenuSettings.cpp" -O -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -nostdinc -Wno-multichar -Wno-deprecated -D_ZETA_USING_DEPRECATED_API_=1 -D_ZETA_TS_FIND_DIR_=1 -D__HAIKU__ -DHAIKU_DISTRO_COMPATIBILITY_DEFAULT -D__INTEL__ -DARCH_x86 -DHAIKU_TARGET_PLATFORM_HAIKU -iquote src/preferences/menu -iquote generated/objects/common/preferences/menu -iquote generated/objects/linux/x86/common/preferences/menu -iquote generated/objects/haiku/x86/common/preferences/menu -I headers -I headers/posix -I headers/gnu -I headers/glibc -I headers/os -I headers/os/add-ons -I headers/os/add-ons/file_system -I headers/os/add-ons/graphics -I headers/os/add-ons/input_server -I headers/os/add-ons/registrar -I headers/os/add-ons/screen_saver -I headers/os/add-ons/tracker -I headers/os/app -I headers/os/device -I headers/os/drivers -I headers/os/game -I headers/os/interface -I headers/os/kernel -I headers/os/media -I headers/os/mail -I headers/os/midi -I headers/os/midi2 -I headers/os/net -I headers/os/opengl -I headers/os/storage -I headers/os/support -I headers/os/translation -I headers/private/. -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2 -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/i586-pc-haiku -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/backward -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/ext -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/include -o "generated/objects/haiku/x86/release/preferences/menu/MenuSettings.o" ; ...failed C++ generated/objects/haiku/x86/release/preferences/menu/MenuSettings.o ... /Fredrik Ekdahl From fekdahl at gmail.com Wed Jan 9 18:26:51 2008 From: fekdahl at gmail.com (Fredrik Ekdahl) Date: Wed, 09 Jan 2008 18:26:51 +0100 Subject: [Haiku-commits] r23307 - in haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam: . addons/sonix In-Reply-To: <200801091410.m09EAb5Y026412@sheep.berlios.de> References: <200801091410.m09EAb5Y026412@sheep.berlios.de> Message-ID: <1199899612.6152.3.camel@ekdahl> ons 2008-01-09 klockan 15:10 +0100 skrev mmu_man at BerliOS: > Author: mmu_man > Date: 2008-01-09 15:10:37 +0100 (Wed, 09 Jan 2008) > New Revision: 23307 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23307&view=rev > > Modified: > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDeframer.cpp > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDeframer.h > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.h > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Producer.cpp > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.h > Log: > Make CamFrame a subclass of BMallocIO to add a timestamp field. > Set the field on allocation and pass it around. > Still disabled as CodyCam drops everything, I should probably drop old frames from the buffer... > for now it uses system_time() to make CodyCam happy. > This breaks the build: C++ generated/objects/haiku/x86/release/add-ons/media/media-add-ons/usb_webcam/SonixCamDevice.o src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp: In constructor 'SonixCamDevice::SonixCamDevice(CamDeviceAddon&, BUSBDevice*)': src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp:69: warning: comparison between signed and unsigned integer expressions src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp: In member function 'virtual ssize_t SonixCamDevice::WriteIIC(uint8, uint8*, size_t)': src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp:231: warning: unused variable 'status' src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp: In member function 'virtual ssize_t SonixCamDevice::ReadIIC(uint8, uint8*)': src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp:268: warning: unused variable 'status' src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp: At global scope: src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp:418: error: default argument given for parameter 2 of 'status_t SonixCamDevice::GetFrameBitmap(BBitmap**, bigtime_t*)' src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.h:71: error: after previous specification in 'virtual status_t SonixCamDevice::GetFrameBitmap(BBitmap**, bigtime_t*)' src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp: In member function 'virtual status_t SonixCamDevice::GetFrameBitmap(BBitmap**, bigtime_t*)': src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp:434: warning: converting to 'long int' from 'float' src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp:435: warning: converting to 'long int' from 'float' src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp: In member function 'virtual status_t SonixCamDevice::FillFrameBuffer(BBuffer*, bigtime_t*)': src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp:465: warning: converting to 'long int' from 'float' src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp:466: warning: converting to 'long int' from 'float' src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp:469: warning: comparison between signed and unsigned integer expressions src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp:475: warning: comparison between signed and unsigned integer expressions /media/data/develop/haiku/trunk/generated/cross-tools/bin/i586-pc-haiku-gcc -c "src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp" -O -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -nostdinc -Wno-multichar -Wno-deprecated -D_ZETA_USING_DEPRECATED_API_=1 -D_ZETA_TS_FIND_DIR_=1 -D__HAIKU__ -DHAIKU_DISTRO_COMPATIBILITY_DEFAULT -D__INTEL__ -DARCH_x86 -DHAIKU_TARGET_PLATFORM_HAIKU -iquote src/add-ons/media/media-add-ons/usb_webcam -iquote generated/objects/common/add-ons/media/media-add-ons/usb_webcam -iquote generated/objects/linux/x86/common/add-ons/media/media-add-ons/usb_webcam -iquote generated/objects/haiku/x86/common/add-ons/media/media-add-ons/usb_webcam -iquote src/add-ons/media/media-add-ons/usb_webcam/addons/quickcam -iquote src/add-ons/media/media-add-ons/usb_webcam/addons/sonix -iquote src/add-ons/media/media-add-ons/usb_webcam/cstransforms -iquote src/add-ons/media/media-add-ons/usb_webcam/sensors -I headers/libs/usb -I headers -I headers/posix -I headers/gnu -I headers/glibc -I headers/os -I headers/os/add-ons -I headers/os/add-ons/file_system -I headers/os/add-ons/graphics -I headers/os/add-ons/input_server -I headers/os/add-ons/registrar -I headers/os/add-ons/screen_saver -I headers/os/add-ons/tracker -I headers/os/app -I headers/os/device -I headers/os/drivers -I headers/os/game -I headers/os/interface -I headers/os/kernel -I headers/os/media -I headers/os/mail -I headers/os/midi -I headers/os/midi2 -I headers/os/net -I headers/os/opengl -I headers/os/storage -I headers/os/support -I headers/os/translation -I headers/private/. -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2 -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/i586-pc-haiku -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/backward -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/ext -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/include -o "generated/objects/haiku/x86/release/add-ons/media/media-add-ons/usb_webcam/SonixCamDevice.o" ; ...failed C++ generated/objects/haiku/x86/release/add-ons/media/media-add-ons/usb_webcam/SonixCamDevice.o ... /Fredrik Ekdahl From marcusoverhagen at mail.berlios.de Wed Jan 9 18:45:14 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 18:45:14 +0100 Subject: [Haiku-commits] r23312 - haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix Message-ID: <200801091745.m09HjENQ018124@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 18:45:12 +0100 (Wed, 09 Jan 2008) New Revision: 23312 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23312&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp Log: fix gcc4 build Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp 2008-01-09 15:42:54 UTC (rev 23311) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp 2008-01-09 17:45:12 UTC (rev 23312) @@ -415,7 +415,7 @@ // ----------------------------------------------------------------------------- status_t -SonixCamDevice::GetFrameBitmap(BBitmap **bm, bigtime_t *stamp=NULL) +SonixCamDevice::GetFrameBitmap(BBitmap **bm, bigtime_t *stamp /* = NULL */) { BBitmap *b; CamFrame *f; From marcusoverhagen at arcor.de Wed Jan 9 18:47:35 2008 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Wed, 9 Jan 2008 18:47:35 +0100 (CET) Subject: [Haiku-commits] r23307 - in haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam: . addons/sonix In-Reply-To: <1199899612.6152.3.camel@ekdahl> References: <1199899612.6152.3.camel@ekdahl> <200801091410.m09EAb5Y026412@sheep.berlios.de> Message-ID: <2107299.1199900855873.JavaMail.ngmail@webmail12> > > This breaks the build: > Should be fixed in r23312 regards Marcus Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 Euro inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From marcusoverhagen at mail.berlios.de Wed Jan 9 18:48:33 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 18:48:33 +0100 Subject: [Haiku-commits] r23313 - haiku/trunk/src/preferences/menu Message-ID: <200801091748.m09HmXxf022807@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 18:48:32 +0100 (Wed, 09 Jan 2008) New Revision: 23313 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23313&view=rev Modified: haiku/trunk/src/preferences/menu/MenuSettings.cpp Log: fix gcc4 build Modified: haiku/trunk/src/preferences/menu/MenuSettings.cpp =================================================================== --- haiku/trunk/src/preferences/menu/MenuSettings.cpp 2008-01-09 17:45:12 UTC (rev 23312) +++ haiku/trunk/src/preferences/menu/MenuSettings.cpp 2008-01-09 17:48:32 UTC (rev 23313) @@ -13,6 +13,7 @@ #include #include #include +#include MenuSettings::MenuSettings() From marcusoverhagen at arcor.de Wed Jan 9 18:49:37 2008 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Wed, 9 Jan 2008 18:49:37 +0100 (CET) Subject: [Haiku-commits] r23296 - haiku/trunk/src/preferences/menu In-Reply-To: <1199899122.6152.1.camel@ekdahl> References: <1199899122.6152.1.camel@ekdahl> <200801091036.m09Aalu4007539@sheep.berlios.de> Message-ID: <32729473.1199900977762.JavaMail.ngmail@webmail12> > > > > Build is broken since this change: should be fixed in r23313. regards Marcus Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 Euro inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From marcusoverhagen at mail.berlios.de Wed Jan 9 18:53:31 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 18:53:31 +0100 Subject: [Haiku-commits] r23314 - haiku/trunk/src/add-ons/kernel/busses/ide/silicon_image_3112 Message-ID: <200801091753.m09HrVb5026915@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 18:53:30 +0100 (Wed, 09 Jan 2008) New Revision: 23314 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23314&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/ide/silicon_image_3112/silicon_image_3112.c Log: fix build Modified: haiku/trunk/src/add-ons/kernel/busses/ide/silicon_image_3112/silicon_image_3112.c =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/ide/silicon_image_3112/silicon_image_3112.c 2008-01-09 17:48:32 UTC (rev 23313) +++ haiku/trunk/src/add-ons/kernel/busses/ide/silicon_image_3112/silicon_image_3112.c 2008-01-09 17:53:30 UTC (rev 23314) @@ -473,9 +473,9 @@ if (1 /* debug */){ uint8 bus, device, function; uint16 vendorID, deviceID; - dm->get_attr_uint16(node, PCI_DEVICE_BUS_ITEM, &bus, true); - dm->get_attr_uint16(node, PCI_DEVICE_DEVICE_ITEM, &device, true); - dm->get_attr_uint16(node, PCI_DEVICE_FUNCTION_ITEM, &function, true); + dm->get_attr_uint8(node, PCI_DEVICE_BUS_ITEM, &bus, true); + dm->get_attr_uint8(node, PCI_DEVICE_DEVICE_ITEM, &device, true); + dm->get_attr_uint8(node, PCI_DEVICE_FUNCTION_ITEM, &function, true); dm->get_attr_uint16(node, PCI_DEVICE_VENDOR_ID_ITEM, &vendorID, true); dm->get_attr_uint16(node, PCI_DEVICE_DEVICE_ID_ITEM, &deviceID, true); TRACE("bus %3d, device %2d, function %2d: vendor %04x, device %04x\n", From marcusoverhagen at mail.berlios.de Wed Jan 9 18:54:10 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 18:54:10 +0100 Subject: [Haiku-commits] r23315 - haiku/trunk/src/add-ons/kernel/generic/ide_adapter Message-ID: <200801091754.m09HsAK7027318@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 18:54:10 +0100 (Wed, 09 Jan 2008) New Revision: 23315 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23315&view=rev Modified: haiku/trunk/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c Log: fix the build Modified: haiku/trunk/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c =================================================================== --- haiku/trunk/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c 2008-01-09 17:53:30 UTC (rev 23314) +++ haiku/trunk/src/add-ons/kernel/generic/ide_adapter/ide_adapter.c 2008-01-09 17:54:10 UTC (rev 23315) @@ -337,9 +337,9 @@ if (1 /* debug */){ uint8 bus, device, function; uint16 vendorID, deviceID; - pnp->get_attr_uint16(node, PCI_DEVICE_BUS_ITEM, &bus, true); - pnp->get_attr_uint16(node, PCI_DEVICE_DEVICE_ITEM, &device, true); - pnp->get_attr_uint16(node, PCI_DEVICE_FUNCTION_ITEM, &function, true); + pnp->get_attr_uint8(node, PCI_DEVICE_BUS_ITEM, &bus, true); + pnp->get_attr_uint8(node, PCI_DEVICE_DEVICE_ITEM, &device, true); + pnp->get_attr_uint8(node, PCI_DEVICE_FUNCTION_ITEM, &function, true); pnp->get_attr_uint16(node, PCI_DEVICE_VENDOR_ID_ITEM, &vendorID, true); pnp->get_attr_uint16(node, PCI_DEVICE_DEVICE_ID_ITEM, &deviceID, true); TRACE("PCI-IDE: bus %3d, device %2d, function %2d: vendor %04x, device %04x\n", From axeld at mail.berlios.de Wed Jan 9 19:08:16 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Jan 2008 19:08:16 +0100 Subject: [Haiku-commits] r23316 - haiku/trunk/src/system/kernel/arch/x86 Message-ID: <200801091808.m09I8GNL006147@sheep.berlios.de> Author: axeld Date: 2008-01-09 19:08:15 +0100 (Wed, 09 Jan 2008) New Revision: 23316 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23316&view=rev Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp Log: * Added a KDL function "call" that can show the arguments together with a function in the stack trace (only works reliably when a stack frame is exists, and you'll have to know the number of arguments). * Refactored the functions a bit and extracted setup_for_thread() out of stack_trace() to be used by show_call() as well. Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp 2008-01-09 17:54:10 UTC (rev 23315) +++ haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp 2008-01-09 18:08:15 UTC (rev 23316) @@ -99,7 +99,7 @@ status = image_debug_lookup_user_symbol_address(thread->team, eip, &baseAddress, &symbol, &image, &exactMatch); } - + kprintf("%08lx (+%4ld) %08lx", ebp, diff, eip); if (status == B_OK) { @@ -138,26 +138,23 @@ kprintf("user esp 0x%lx", frame->user_esp); } kprintf("\n"); - kprintf(" vector: 0x%lx, error code: 0x%lx\n", frame->vector, frame->error_code); + kprintf(" vector: 0x%lx, error code: 0x%lx\n", frame->vector, + frame->error_code); } -static int -stack_trace(int argc, char **argv) +static void +setup_for_thread(char *arg, struct thread **_thread, uint32 *_ebp, + struct iframe_stack **_frameStack, uint32 *_oldPageDirectory) { - uint32 previousLocations[NUM_PREVIOUS_LOCATIONS]; - struct iframe_stack *frameStack; struct thread *thread = NULL; - addr_t oldPageDirectory = 0; - uint32 ebp = 0; - int32 i, num = 0, last = 0; - if (argc == 2) { - thread_id id = strtoul(argv[1], NULL, 0); + if (arg != NULL) { + thread_id id = strtoul(arg, NULL, 0); thread = thread_get_thread_struct_locked(id); if (thread == NULL) { kprintf("could not find thread %ld\n", id); - return 0; + return; } if (id != thread_get_current_thread_id()) { @@ -167,38 +164,60 @@ thread_get_current_thread(), thread); if (newPageDirectory != 0) { - read_cr3(oldPageDirectory); + read_cr3(*_oldPageDirectory); write_cr3(newPageDirectory); } // read %ebp from the thread's stack stored by a pushad - ebp = thread->arch_info.current_stack.esp[2]; + *_ebp = thread->arch_info.current_stack.esp[2]; } else thread = NULL; - } else if (argc > 2) { - kprintf("usage: %s [thread id]\n", argv[0]); - return 0; } if (thread == NULL) { // if we don't have a thread yet, we want the current one + // (ebp has been set by the caller for this case already) thread = thread_get_current_thread(); - ebp = x86_read_ebp(); } // We don't have a thread pointer early in the boot process if (thread != NULL) - frameStack = &thread->arch_info.iframes; + *_frameStack = &thread->arch_info.iframes; else - frameStack = &gBootFrameStack; + *_frameStack = &gBootFrameStack; + *_thread = thread; +} + + +static int +stack_trace(int argc, char **argv) +{ + uint32 previousLocations[NUM_PREVIOUS_LOCATIONS]; + struct iframe_stack *frameStack; + struct thread *thread = NULL; + addr_t oldPageDirectory = 0; + uint32 ebp = x86_read_ebp(); + int32 i, num = 0, last = 0; + + if (argc > 2) { + kprintf("usage: %s [thread id]\n", argv[0]); + return 0; + } + + setup_for_thread(argc == 2 ? argv[1] : NULL, &thread, &ebp, &frameStack, + &oldPageDirectory); + if (thread != NULL) { - kprintf("stack trace for thread 0x%lx \"%s\"\n", thread->id, thread->name); + kprintf("stack trace for thread 0x%lx \"%s\"\n", thread->id, + thread->name); kprintf(" kernel stack: %p to %p\n", - (void *)thread->kernel_stack_base, (void *)(thread->kernel_stack_base + KERNEL_STACK_SIZE)); + (void *)thread->kernel_stack_base, + (void *)(thread->kernel_stack_base + KERNEL_STACK_SIZE)); if (thread->user_stack_base != 0) { - kprintf(" user stack: %p to %p\n", (void *)thread->user_stack_base, + kprintf(" user stack: %p to %p\n", + (void *)thread->user_stack_base, (void *)(thread->user_stack_base + thread->user_stack_size)); } } @@ -254,7 +273,137 @@ } +static void +print_call(struct thread *thread, addr_t eip, addr_t ebp, int32 argCount) +{ + const char *symbol, *image; + addr_t baseAddress; + bool exactMatch; + status_t status; + + status = elf_debug_lookup_symbol_address(eip, &baseAddress, &symbol, + &image, &exactMatch); + if (status != B_OK) { + // try to locate the image in the images loaded into user space + status = image_debug_lookup_user_symbol_address(thread->team, eip, + &baseAddress, &symbol, &image, &exactMatch); + } + + kprintf("%08lx %08lx", ebp, eip); + + if (status == B_OK) { + if (symbol != NULL) { + kprintf(" <%s>:%s%s", image, symbol, + exactMatch ? "" : " (nearest)"); + } else { + kprintf(" <%s@%p>:unknown + 0x%04lx", image, + (void *)baseAddress, eip - baseAddress); + } + } else { + vm_area *area = NULL; + if (thread->team->address_space != NULL) + area = vm_area_lookup(thread->team->address_space, eip); + if (area != NULL) { + kprintf(" %ld:%s@%p + %#lx", area->id, area->name, + (void *)area->base, eip - area->base); + } + } + + int32 *arg = (int32 *)(ebp + 8); + kprintf("("); + + for (int32 i = 0; i < argCount; i++) { + if (i > 0) + kprintf(", "); + kprintf("%#lx", *arg); + if (*arg > -0x10000 && *arg < 0x10000) + kprintf(" (%ld)", *arg); + arg++; + } + + kprintf(")\n"); +} + + static int +show_call(int argc, char **argv) +{ + struct iframe_stack *frameStack; + struct thread *thread = NULL; + addr_t oldPageDirectory = 0; + uint32 ebp = x86_read_ebp(); + int32 argCount = 0; + + if (argc >= 2 && argv[argc - 1][0] == '-') { + argCount = strtoul(argv[argc - 1] + 1, NULL, 0); + if (argCount < 0 || argCount > 16) { + kprintf("Invalid argument count \"%ld\".\n", argCount); + return 0; + } + argc--; + } + + if (argc < 2 || argc > 3) { + kprintf("usage: %s [thread id] [-]\n", argv[0]); + return 0; + } + + setup_for_thread(argc == 3 ? argv[1] : NULL, &thread, &ebp, &frameStack, + &oldPageDirectory); + + int32 callIndex = strtoul(argv[argc == 3 ? 2 : 1], NULL, 0); + + if (thread != NULL) + kprintf("thread %ld, %s\n", thread->id, thread->name); + + int32 index = 1; + for (; index <= callIndex; index++) { + bool isIFrame = false; + // see if the ebp matches the iframe + for (int32 i = 0; i < frameStack->index; i++) { + if (ebp == ((uint32)frameStack->frames[i] - 8)) { + // it's an iframe + isIFrame = true; + } + } + + if (isIFrame) { + struct iframe *frame = (struct iframe *)(ebp + 8); + + if (index == callIndex) + print_call(thread, frame->eip, ebp, argCount); + + ebp = frame->ebp; + } else { + addr_t eip, nextEbp; + + if (get_next_frame(ebp, &nextEbp, &eip) != B_OK) { + kprintf("%08lx -- read fault\n", ebp); + break; + } + + if (eip == 0 || ebp == 0) + break; + + if (index == callIndex) + print_call(thread, eip, ebp, argCount); + ebp = nextEbp; + } + + if (ebp == 0) + break; + } + + if (oldPageDirectory != 0) { + // switch back to the previous page directory to no cause any troubles + write_cr3(oldPageDirectory); + } + + return 0; +} + + +static int dump_iframes(int argc, char **argv) { struct iframe_stack *frameStack; @@ -316,6 +465,7 @@ add_debugger_command("bt", &stack_trace, "Same as \"sc\" (as in gdb)"); add_debugger_command("sc", &stack_trace, "Stack crawl for current thread (or any other)"); add_debugger_command("iframe", &dump_iframes, "Dump iframes for the specified thread"); + add_debugger_command("call", &show_call, "Show call with arguments"); return B_NO_ERROR; } From mmu_man at mail.berlios.de Wed Jan 9 19:15:29 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 9 Jan 2008 19:15:29 +0100 Subject: [Haiku-commits] r23317 - haiku/trunk/src/apps/codycam Message-ID: <200801091815.m09IFTgQ012245@sheep.berlios.de> Author: mmu_man Date: 2008-01-09 19:15:26 +0100 (Wed, 09 Jan 2008) New Revision: 23317 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23317&view=rev Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp haiku/trunk/src/apps/codycam/CodyCam.h haiku/trunk/src/apps/codycam/Jamfile haiku/trunk/src/apps/codycam/VideoConsumer.cpp haiku/trunk/src/apps/codycam/VideoConsumer.h Log: Start of an SFTP uploader. Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp =================================================================== --- haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-01-09 18:08:15 UTC (rev 23316) +++ haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-01-09 18:15:26 UTC (rev 23317) @@ -595,6 +595,14 @@ message->FindInt32("be:translator", &(fFtpInfo.translator)); break; + case msg_upl_client: + if (control != NULL) { + int32 client; + message->FindInt32("client", &(fFtpInfo.uploadClient)); + FTPINFO("upl client = %d\n", fFtpInfo.uploadClient);//XXX + } + break; + case msg_server: if (control != NULL) { strncpy(fFtpInfo.serverText, ((BTextControl*)control)->Text(), 64); @@ -737,7 +745,18 @@ aFrame.bottom -= kYBuffer; fFtpSetupBox = new BBox(aFrame, "Ftp Setup", B_FOLLOW_ALL, B_WILL_DRAW); - fFtpSetupBox->SetLabel("Ftp Setup"); + fUploadClientMenu = new BPopUpMenu("Send to..."); + for (int i = 0; kUploadClient[i]; i++) { + BMessage *m = new BMessage(msg_upl_client); + m->AddInt32("client", i); + fUploadClientMenu->AddItem(new BMenuItem(kUploadClient[i], m)); + } + fUploadClientMenu->SetTargetForItems(this); + //fUploadClientMenu->FindItem(fCaptureRateSetting->Value())->SetMarked(true); + fUploadClientSelector = new BMenuField(aFrame, "UploadClient", "", fUploadClientMenu); + fUploadClientSelector->SetDivider(0.0); + + fFtpSetupBox->SetLabel(fUploadClientSelector); theView->AddChild(fFtpSetupBox); aFrame = fFtpSetupBox->Bounds(); Modified: haiku/trunk/src/apps/codycam/CodyCam.h =================================================================== --- haiku/trunk/src/apps/codycam/CodyCam.h 2008-01-09 18:08:15 UTC (rev 23316) +++ haiku/trunk/src/apps/codycam/CodyCam.h 2008-01-09 18:15:26 UTC (rev 23317) @@ -41,6 +41,7 @@ msg_translate = 'tran', + msg_upl_client = 'ucli', msg_server = 'srvr', msg_login = 'lgin', msg_password = 'pswd', @@ -77,6 +78,13 @@ }; +const char* kUploadClient[] = { + "FTP", + "SFTP", + 0 +}; + + class CodyCam : public BApplication { public: CodyCam(); @@ -135,6 +143,8 @@ BMenuField* fCaptureRateSelector; BMenu* fImageFormatMenu; BMenuField* fImageFormatSelector; + BMenu* fUploadClientMenu; + BMenuField* fUploadClientSelector; BBox* fFtpSetupBox; BTextControl* fServerName; BTextControl* fLoginId; Modified: haiku/trunk/src/apps/codycam/Jamfile =================================================================== --- haiku/trunk/src/apps/codycam/Jamfile 2008-01-09 18:08:15 UTC (rev 23316) +++ haiku/trunk/src/apps/codycam/Jamfile 2008-01-09 18:15:26 UTC (rev 23317) @@ -5,7 +5,9 @@ Application CodyCam : CodyCam.cpp FileUploadClient.cpp + SpawningUploadClient.cpp FtpClient.cpp + SftpClient.cpp Settings.cpp SettingsHandler.cpp VideoConsumer.cpp Modified: haiku/trunk/src/apps/codycam/VideoConsumer.cpp =================================================================== --- haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-01-09 18:08:15 UTC (rev 23316) +++ haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-01-09 18:15:26 UTC (rev 23317) @@ -3,7 +3,9 @@ // VideoConsumer.cpp +#include "FileUploadClient.h" #include "FtpClient.h" +#include "SftpClient.h" #include "VideoConsumer.h" #include @@ -53,6 +55,7 @@ fRate(1000000), fImageFormat(0), fTranslator(0), + fUploadClient(0), fPassiveFtp(true) { FUNCTION("VideoConsumer::VideoConsumer\n"); @@ -205,6 +208,7 @@ fImageFormat = info->imageFormat; fTranslator = info->translator; fPassiveFtp = info->passiveFtp; + fUploadClient = info->uploadClient; strcpy(fFileNameText, info->fileNameText); strcpy(fServerText, info->serverText); strcpy(fLoginText, info->loginText); @@ -230,7 +234,7 @@ void VideoConsumer::BufferReceived(BBuffer* buffer) { - LOOP("VideoConsumer::Buffer #%ld received\n", buffer->ID()); + LOOP("VideoConsumer::Buffer #%ld received, start_time %Ld\n", buffer->ID(), buffer->Header()->start_time); if (RunState() == B_STOPPED) { buffer->Recycle(); @@ -673,25 +677,37 @@ status_t VideoConsumer::FtpSave(char* filename) { - FtpClient ftp; + FileUploadClient *ftp; + + //XXX: make that cleaner + switch (fUploadClient) { + case 0: + ftp = new FtpClient; + break; + case 1: + ftp = new SftpClient; + break; + default: + return EINVAL; + } - ftp.SetPassive(fPassiveFtp); + ftp->SetPassive(fPassiveFtp); // ftp the local file to our web site UpdateFtpStatus("Logging in ..."); - if (ftp.Connect((string)fServerText, (string)fLoginText, (string)fPasswordText)) { + if (ftp->Connect((string)fServerText, (string)fLoginText, (string)fPasswordText)) { // connect to server UpdateFtpStatus("Connected ..."); - if (ftp.ChangeDir((string)fDirectoryText)) { + if (ftp->ChangeDir((string)fDirectoryText)) { // cd to the desired directory UpdateFtpStatus("Transmitting ..."); - if (ftp.PutFile((string)filename, (string)"temp")) { + if (ftp->PutFile((string)filename, (string)"temp")) { // send the file to the server UpdateFtpStatus("Renaming ..."); - if (ftp.MoveFile((string)"temp", (string)filename)) { + if (ftp->MoveFile((string)"temp", (string)filename)) { // change to the desired name uint32 time = real_time_clock(); char s[80]; @@ -699,6 +715,7 @@ strcat(s, ctime((const long*)&time)); s[strlen(s) - 1] = 0; UpdateFtpStatus(s); + delete ftp; return B_OK; } else @@ -713,6 +730,7 @@ else UpdateFtpStatus("Server login failed"); + delete ftp; return B_ERROR; } Modified: haiku/trunk/src/apps/codycam/VideoConsumer.h =================================================================== --- haiku/trunk/src/apps/codycam/VideoConsumer.h 2008-01-09 18:08:15 UTC (rev 23316) +++ haiku/trunk/src/apps/codycam/VideoConsumer.h 2008-01-09 18:15:26 UTC (rev 23317) @@ -20,6 +20,7 @@ bigtime_t rate; uint32 imageFormat; int32 translator; + int32 uploadClient; bool passiveFtp; char fileNameText[64]; char serverText[64]; @@ -137,6 +138,7 @@ bigtime_t fRate; uint32 fImageFormat; int32 fTranslator; + int32 fUploadClient; bool fPassiveFtp; char fFileNameText[64]; char fServerText[64]; From axeld at mail.berlios.de Wed Jan 9 19:15:29 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Jan 2008 19:15:29 +0100 Subject: [Haiku-commits] r23318 - in haiku/trunk: headers/private/kernel src/system/kernel/vm Message-ID: <200801091815.m09IFTOx012272@sheep.berlios.de> Author: axeld Date: 2008-01-09 19:15:28 +0100 (Wed, 09 Jan 2008) New Revision: 23318 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23318&view=rev Modified: haiku/trunk/headers/private/kernel/vm_page.h haiku/trunk/src/system/kernel/vm/vm_cache.cpp haiku/trunk/src/system/kernel/vm/vm_page.cpp Log: * My last change to vm_page.cpp made an existing bug much more likely to appear: when freeing a modified page, it wouldn't have a cache anymore, but set_page_state_nolock() depended on it. * To work around this, I added a vm_page_free() function, which the caches that free modified pages have to call (but others may, too). It will correctly maintain the sModifiedTemporaryPages counter in case the cache has already been removed. Modified: haiku/trunk/headers/private/kernel/vm_page.h =================================================================== --- haiku/trunk/headers/private/kernel/vm_page.h 2008-01-09 18:15:26 UTC (rev 23317) +++ haiku/trunk/headers/private/kernel/vm_page.h 2008-01-09 18:15:28 UTC (rev 23318) @@ -26,6 +26,7 @@ status_t vm_mark_page_inuse(addr_t page); status_t vm_mark_page_range_inuse(addr_t startPage, addr_t length); +void vm_page_free(struct vm_cache *cache, struct vm_page *page); status_t vm_page_set_state(struct vm_page *page, int state); void vm_page_requeue(struct vm_page *page, bool tail); Modified: haiku/trunk/src/system/kernel/vm/vm_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2008-01-09 18:15:26 UTC (rev 23317) +++ haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2008-01-09 18:15:28 UTC (rev 23318) @@ -152,7 +152,7 @@ TRACE(("vm_cache_release_ref: freeing page 0x%lx\n", oldPage->physical_page_number)); - vm_page_set_state(oldPage, PAGE_STATE_FREE); + vm_page_free(cache, oldPage); } // remove the ref to the source @@ -514,7 +514,7 @@ // remove the page and put it into the free queue vm_cache_remove_page(cache, page); - vm_page_set_state(page, PAGE_STATE_FREE); + vm_page_free(cache, page); } page = next; Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-01-09 18:15:26 UTC (rev 23317) +++ haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-01-09 18:15:28 UTC (rev 23318) @@ -656,17 +656,20 @@ panic("vm_page_set_state: invalid target state %d\n", pageState); } - if (pageState == PAGE_STATE_CLEAR || pageState == PAGE_STATE_FREE || pageState == PAGE_STATE_INACTIVE) { + if (pageState == PAGE_STATE_CLEAR || pageState == PAGE_STATE_FREE + || pageState == PAGE_STATE_INACTIVE) { if (sPageDeficit > 0) sFreePageCondition.NotifyOne(); if (pageState != PAGE_STATE_INACTIVE && page->cache != NULL) panic("to be freed page %p has cache", page); } - if (pageState == PAGE_STATE_MODIFIED && page->cache->temporary) - sModifiedTemporaryPages++; - else if (page->state == PAGE_STATE_MODIFIED && page->cache->temporary) - sModifiedTemporaryPages--; + if (page->cache != NULL) { + if (pageState == PAGE_STATE_MODIFIED && page->cache->temporary) + sModifiedTemporaryPages++; + else if (page->state == PAGE_STATE_MODIFIED && page->cache->temporary) + sModifiedTemporaryPages--; + } #if TRACK_PAGE_ALLOCATIONS if ((pageState == PAGE_STATE_CLEAR || pageState == PAGE_STATE_FREE) @@ -1708,6 +1711,23 @@ } +/*! Free the page that belonged to a certain cache. + You can use vm_page_set_state() manually if you prefer, but only + if the page does not equal PAGE_STATE_MODIFIED. +*/ +void +vm_page_free(vm_cache *cache, vm_page *page) +{ + InterruptsSpinLocker _(sPageLock); + + if (page->cache == NULL && page->state == PAGE_STATE_MODIFIED + && cache->temporary) + sModifiedTemporaryPages--; + + set_page_state_nolock(page, PAGE_STATE_FREE); +} + + status_t vm_page_set_state(vm_page *page, int pageState) { From axeld at mail.berlios.de Wed Jan 9 19:39:42 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Jan 2008 19:39:42 +0100 Subject: [Haiku-commits] r23319 - haiku/trunk/src/system/kernel/vm Message-ID: <200801091839.m09Idg6a010210@sheep.berlios.de> Author: axeld Date: 2008-01-09 19:39:42 +0100 (Wed, 09 Jan 2008) New Revision: 23319 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23319&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp Log: Minor refactoring. Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-01-09 18:15:28 UTC (rev 23318) +++ haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-01-09 18:39:42 UTC (rev 23319) @@ -664,10 +664,10 @@ if (pageState != PAGE_STATE_INACTIVE && page->cache != NULL) panic("to be freed page %p has cache", page); } - if (page->cache != NULL) { - if (pageState == PAGE_STATE_MODIFIED && page->cache->temporary) + if (page->cache != NULL && page->cache->temporary) { + if (pageState == PAGE_STATE_MODIFIED) sModifiedTemporaryPages++; - else if (page->state == PAGE_STATE_MODIFIED && page->cache->temporary) + else if (page->state == PAGE_STATE_MODIFIED) sModifiedTemporaryPages--; } From fekdahl at gmail.com Wed Jan 9 19:43:08 2008 From: fekdahl at gmail.com (Fredrik Ekdahl) Date: Wed, 09 Jan 2008 19:43:08 +0100 Subject: [Haiku-commits] r23317 - haiku/trunk/src/apps/codycam In-Reply-To: <200801091815.m09IFTgQ012245@sheep.berlios.de> References: <200801091815.m09IFTgQ012245@sheep.berlios.de> Message-ID: <1199904188.6058.2.camel@ekdahl> ons 2008-01-09 klockan 19:15 +0100 skrev mmu_man at BerliOS: > Author: mmu_man > Date: 2008-01-09 19:15:26 +0100 (Wed, 09 Jan 2008) > New Revision: 23317 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23317&view=rev > > Modified: > haiku/trunk/src/apps/codycam/CodyCam.cpp > haiku/trunk/src/apps/codycam/CodyCam.h > haiku/trunk/src/apps/codycam/Jamfile > haiku/trunk/src/apps/codycam/VideoConsumer.cpp > haiku/trunk/src/apps/codycam/VideoConsumer.h > Log: > Start of an SFTP uploader. > > Modified: haiku/trunk/src/apps/codycam/Jamfile > =================================================================== > --- haiku/trunk/src/apps/codycam/Jamfile 2008-01-09 18:08:15 UTC (rev 23316) > +++ haiku/trunk/src/apps/codycam/Jamfile 2008-01-09 18:15:26 UTC (rev 23317) > @@ -5,7 +5,9 @@ > Application CodyCam : > CodyCam.cpp > FileUploadClient.cpp > + SpawningUploadClient.cpp > FtpClient.cpp > + SftpClient.cpp > Settings.cpp > SettingsHandler.cpp > VideoConsumer.cpp > > Modified: haiku/trunk/src/apps/codycam/VideoConsumer.cpp > =================================================================== > --- haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-01-09 18:08:15 UTC (rev 23316) > +++ haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-01-09 18:15:26 UTC (rev 23317) > @@ -3,7 +3,9 @@ > // VideoConsumer.cpp > > > +#include "FileUploadClient.h" > #include "FtpClient.h" > +#include "SftpClient.h" > #include "VideoConsumer.h" > Where are SpawningUploadClient.cpp, SftpClient.cpp and SftpClient.h? /Fredrik Ekdahl From mmu_man at mail.berlios.de Wed Jan 9 19:51:00 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 9 Jan 2008 19:51:00 +0100 Subject: [Haiku-commits] r23320 - haiku/trunk/src/apps/codycam Message-ID: <200801091851.m09Ip0Te010781@sheep.berlios.de> Author: mmu_man Date: 2008-01-09 19:50:59 +0100 (Wed, 09 Jan 2008) New Revision: 23320 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23320&view=rev Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp haiku/trunk/src/apps/codycam/CodyCam.h haiku/trunk/src/apps/codycam/VideoConsumer.cpp Log: sftp uploader seems to be working now :) Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp =================================================================== --- haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-01-09 18:39:42 UTC (rev 23319) +++ haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-01-09 18:50:59 UTC (rev 23320) @@ -428,6 +428,7 @@ fFtpInfo.imageFormat = 0; fFtpInfo.translator = 0; fFtpInfo.passiveFtp = true; + fFtpInfo.uploadClient = 0; strcpy(fFtpInfo.fileNameText, "filename"); strcpy(fFtpInfo.serverText, "server"); strcpy(fFtpInfo.loginText, "login"); @@ -599,7 +600,7 @@ if (control != NULL) { int32 client; message->FindInt32("client", &(fFtpInfo.uploadClient)); - FTPINFO("upl client = %d\n", fFtpInfo.uploadClient);//XXX + FTPINFO("upl client = %d\n", fFtpInfo.uploadClient); } break; @@ -752,7 +753,7 @@ fUploadClientMenu->AddItem(new BMenuItem(kUploadClient[i], m)); } fUploadClientMenu->SetTargetForItems(this); - //fUploadClientMenu->FindItem(fCaptureRateSetting->Value())->SetMarked(true); + fUploadClientMenu->FindItem(fUploadClientSetting->Value())->SetMarked(true); fUploadClientSelector = new BMenuField(aFrame, "UploadClient", "", fUploadClientMenu); fUploadClientSelector->SetDivider(0.0); @@ -832,6 +833,7 @@ fFileName->Invoke(); PostMessage(fImageFormatMenu->FindMarked()->Message()); PostMessage(fCaptureRateMenu->FindMarked()->Message()); + PostMessage(fUploadClientMenu->FindMarked()->Message()); fServerName->Invoke(); fLoginId->Invoke(); fPassword->Invoke(); @@ -861,6 +863,9 @@ fSettings->Add(fCaptureRateSetting = new EnumeratedStringValueSetting("CaptureRate", "Every 5 minutes", kCaptureRate, "capture rate expected", "unrecognized capture rate specified")); + fSettings->Add(fUploadClientSetting = new EnumeratedStringValueSetting("UploadClient", + "FTP", kUploadClient, "upload client name expected", + "unrecognized upload client specified")); fSettings->TryReadingSettings(); } @@ -877,6 +882,7 @@ fFilenameSetting->ValueChanged(fFileName->Text()); fImageFormatSettings->ValueChanged(fImageFormatMenu->FindMarked()->Label()); fCaptureRateSetting->ValueChanged(fCaptureRateMenu->FindMarked()->Label()); + fUploadClientSetting->ValueChanged(fUploadClientMenu->FindMarked()->Label()); fSettings->SaveSettings(); delete fSettings; Modified: haiku/trunk/src/apps/codycam/CodyCam.h =================================================================== --- haiku/trunk/src/apps/codycam/CodyCam.h 2008-01-09 18:39:42 UTC (rev 23319) +++ haiku/trunk/src/apps/codycam/CodyCam.h 2008-01-09 18:50:59 UTC (rev 23320) @@ -164,6 +164,7 @@ BooleanValueSetting* fPassiveFtpSetting; StringValueSetting* fFilenameSetting; StringValueSetting* fImageFormatSettings; + EnumeratedStringValueSetting* fUploadClientSetting; EnumeratedStringValueSetting* fCaptureRateSetting; }; Modified: haiku/trunk/src/apps/codycam/VideoConsumer.cpp =================================================================== --- haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-01-09 18:39:42 UTC (rev 23319) +++ haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-01-09 18:50:59 UTC (rev 23320) @@ -688,6 +688,7 @@ ftp = new SftpClient; break; default: + fprintf(stderr, "invalid upload client %d\n", fUploadClient); return EINVAL; } From mmu_man at mail.berlios.de Wed Jan 9 19:51:55 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 9 Jan 2008 19:51:55 +0100 Subject: [Haiku-commits] r23321 - haiku/trunk/src/apps/codycam Message-ID: <200801091851.m09IptwV010890@sheep.berlios.de> Author: mmu_man Date: 2008-01-09 19:51:55 +0100 (Wed, 09 Jan 2008) New Revision: 23321 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23321&view=rev Added: haiku/trunk/src/apps/codycam/SftpClient.cpp haiku/trunk/src/apps/codycam/SftpClient.h haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp haiku/trunk/src/apps/codycam/SpawningUploadClient.h Log: Might work better with the files :))) Added: haiku/trunk/src/apps/codycam/SftpClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/SftpClient.cpp 2008-01-09 18:50:59 UTC (rev 23320) +++ haiku/trunk/src/apps/codycam/SftpClient.cpp 2008-01-09 18:51:55 UTC (rev 23321) @@ -0,0 +1,223 @@ +#include +#include + +#include "SftpClient.h" + +SftpClient::SftpClient() + : SpawningUploadClient() +{ +} + + +SftpClient::~SftpClient() +{ + if (OutputPipe() >= 0) + SendCommand("quit\n"); +} + + +bool +SftpClient::ChangeDir(const string& dir) +{ + bool rc = false; + int len; + BString cmd("cd"); + BString reply; + cmd << " " << dir.c_str() << "\n"; + SendCommand(cmd.String()); + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %s\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); + if (reply.FindFirst("sftp>") < 0) + return false; + rc = true; + return rc; +} + + +bool +SftpClient::ListDirContents(string& listing) +{ + bool rc = false; + int len; + SendCommand("ls\n"); + BString reply; + do { + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %s\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); + printf("%s", reply.String()); + if (reply.FindFirst("sftp>") == 0) + return true; + } while (true); + return rc; +} + + +bool +SftpClient::PrintWorkingDir(string& dir) +{ + bool rc = false; + int len; + SendCommand("pwd\n"); + BString reply; + return rc; +} + + +bool +SftpClient::Connect(const string& server, const string& login, const string& passwd) +{ + bool rc = false; + BString cmd("sftp "); + cmd << login.c_str(); + cmd << "@" << server.c_str(); + SetCommandLine(cmd.String()); + rc = SpawningUploadClient::Connect(server, login, passwd); + BString reply; + ssize_t len; + + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %d\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); + if (reply.FindFirst("Connecting to ") != 0) + return false; + + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %s\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); + if (reply.FindFirst("password:") < 0) + return false; + + write(OutputPipe(), passwd.c_str(), strlen(passwd.c_str())); + write(OutputPipe(), "\n", 1); + + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %s\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); + if (reply != "\n") + return false; + + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %s\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); + if (reply.FindFirst("sftp>") < 0) + return false; + return rc; +} + + +bool +SftpClient::PutFile(const string& local, const string& remote, ftp_mode mode) +{ + bool rc = false; + int len; + //XXX: handle mode ? + BString cmd("put"); + cmd << " " << local.c_str() << " " << remote.c_str() << "\n"; + SendCommand(cmd.String()); + BString reply; + + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %s\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); + if (reply.FindFirst("Uploading") < 0) + return false; + + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %s\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); + if (reply.FindFirst("sftp>") < 0) + return false; + + rc = true; + return rc; +} + + +bool +SftpClient::GetFile(const string& remote, const string& local, ftp_mode mode) +{ + bool rc = false; + //XXX + return rc; +} + + +// Note: this only works for local remote moves, cross filesystem moves +// will not work +bool +SftpClient::MoveFile(const string& oldPath, const string& newPath) +{ + bool rc = false; + int len; + BString cmd("rename"); + cmd << " " << oldPath.c_str() << " " << newPath.c_str() << "\n"; + SendCommand(cmd.String()); + BString reply; + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %s\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); + if (reply.FindFirst("sftp>") < 0) + return false; + rc = true; + return rc; +} + + +bool +SftpClient::Chmod(const string& path, const string& mod) +{ + bool rc = false; + int len; + //XXX: handle mode ? + BString cmd("chmod"); + cmd << " " << mod.c_str() << " " << path.c_str() << "\n"; + SendCommand(cmd.String()); + BString reply; + + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %s\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); + if (reply.FindFirst("Changing") < 0) + return false; + + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %s\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); + if (reply.FindFirst("sftp>") < 0) + return false; + + rc = true; + return rc; +} + + +void +SftpClient::SetPassive(bool on) +{ +} + + Added: haiku/trunk/src/apps/codycam/SftpClient.h =================================================================== --- haiku/trunk/src/apps/codycam/SftpClient.h 2008-01-09 18:50:59 UTC (rev 23320) +++ haiku/trunk/src/apps/codycam/SftpClient.h 2008-01-09 18:51:55 UTC (rev 23321) @@ -0,0 +1,40 @@ +#ifndef SFTP_CLIENT_H +#define SFTP_CLIENT_H + + +#include +#include + +#include +#include "SpawningUploadClient.h" + +using std::string; + + +class SftpClient : public SpawningUploadClient { + public: + SftpClient(); + ~SftpClient(); + +virtual bool Connect(const string& server, const string& login, + const string& passwd); + + bool PutFile(const string& local, const string& remote, + ftp_mode mode = binary_mode); + + bool GetFile(const string& remote, const string& local, + ftp_mode mode = binary_mode); + + bool MoveFile(const string& oldPath, const string& newPath); + bool ChangeDir(const string& dir); + bool PrintWorkingDir(string& dir); + bool ListDirContents(string& listing); + bool Chmod(const string& path, const string& mod); + + void SetPassive(bool on); + + protected: + +}; + +#endif // SFTP_CLIENT_H Added: haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp 2008-01-09 18:50:59 UTC (rev 23320) +++ haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp 2008-01-09 18:51:55 UTC (rev 23321) @@ -0,0 +1,180 @@ +#include +#include +#include + +#include + +#include "SpawningUploadClient.h" + +SpawningUploadClient::SpawningUploadClient() + : FileUploadClient() + , fCommand() + , fCommandPid(-1) + , fPty(-1) +{ +} + + +SpawningUploadClient::~SpawningUploadClient() +{ + close(fPty); + kill(fCommandPid, SIGTERM); + kill(fCommandPid, SIGKILL); + status_t ret; + wait_for_thread(fCommandPid, &ret); +} + + +bool +SpawningUploadClient::Connect(const string& server, const string& login, const string& passwd) +{ + bool rc = false; +// fCommand += " "; +// fCommand += server; + rc = SpawnCommand(); + return rc; +} + + +bool +SpawningUploadClient::SpawnCommand() +{ + //XXX: should use a system-provided TerminalCommand class + BString shellcmd = "exec"; + const char *args[] = { "/bin/sh", "-c", NULL, NULL }; + char path[20]; + int pty; + for (pty = 0; pty < 0x50; pty++) { + int fd; + sprintf(path, "/dev/pt/%c%1x", 'p' + pty / 16, pty & 0x0f); + printf("trying %s\n", path); + fd = open(path, O_RDWR); + if (fd < 0) + continue; + fPty = fd; + break; + } + if (fPty < 0) + return false; + sprintf(path, "/dev/tt/%c%1x", 'p' + pty / 16, pty & 0x0f); + shellcmd << " 0<" << path; + shellcmd << " 1>" << path; + shellcmd += " 2>&1"; + shellcmd << " ; "; + shellcmd << "export TTY=" << path << "; "; // BeOS hack + shellcmd << "export LC_ALL=C; export LANG=C; "; + shellcmd << "exec "; + shellcmd << fCommand.c_str(); +printf("spawning: '%s'\n", shellcmd.String()); + args[2] = shellcmd.String(); + fCommandPid = load_image(3, args, (const char **)environ); + if (fCommandPid < 0) + return false; + resume_thread(fCommandPid); + return true; +} + + +status_t +SpawningUploadClient::SetCommandLine(const char *command) +{ + fCommand = command; + return B_OK; +} + + +ssize_t +SpawningUploadClient::SendCommand(const char *cmd) +{ + return write(InputPipe(), cmd, strlen(cmd)); +} + + +ssize_t +SpawningUploadClient::ReadReply(BString *to) +{ + char buff[1024]; + ssize_t len; + to->Truncate(0); + len = read(OutputPipe(), buff, 1024); + if (len < 0) + return errno; + to->Append(buff, len); + return len; +} + + +status_t +SpawningUploadClient::ParseReply() +{ + return B_ERROR; +} + + +/* the rest is empty */ + + +bool +SpawningUploadClient::ChangeDir(const string& dir) +{ + bool rc = false; + return rc; +} + + +bool +SpawningUploadClient::ListDirContents(string& listing) +{ + bool rc = false; + return rc; +} + + +bool +SpawningUploadClient::PrintWorkingDir(string& dir) +{ + bool rc = false; + return rc; +} + + +bool +SpawningUploadClient::PutFile(const string& local, const string& remote, ftp_mode mode) +{ + bool rc = false; + return rc; +} + + +bool +SpawningUploadClient::GetFile(const string& remote, const string& local, ftp_mode mode) +{ + bool rc = false; + return rc; +} + + +// Note: this only works for local remote moves, cross filesystem moves +// will not work +bool +SpawningUploadClient::MoveFile(const string& oldPath, const string& newPath) +{ + bool rc = false; + return rc; +} + + +bool +SpawningUploadClient::Chmod(const string& path, const string& mod) +{ + bool rc = false; + return rc; +} + + +void +SpawningUploadClient::SetPassive(bool on) +{ +} + + Added: haiku/trunk/src/apps/codycam/SpawningUploadClient.h =================================================================== --- haiku/trunk/src/apps/codycam/SpawningUploadClient.h 2008-01-09 18:50:59 UTC (rev 23320) +++ haiku/trunk/src/apps/codycam/SpawningUploadClient.h 2008-01-09 18:51:55 UTC (rev 23321) @@ -0,0 +1,49 @@ +#ifndef SPAWNING_UPLOAD_CLIENT_H +#define SPAWNING_UPLOAD_CLIENT_H + +#include "FileUploadClient.h" + +#include +#include +#include + + +class SpawningUploadClient : public FileUploadClient { + public: + SpawningUploadClient(); +virtual ~SpawningUploadClient(); + +virtual bool Connect(const string& server, const string& login, + const string& passwd); + +virtual bool PutFile(const string& local, const string& remote, + ftp_mode mode = binary_mode); + +virtual bool GetFile(const string& remote, const string& local, + ftp_mode mode = binary_mode); + +virtual bool MoveFile(const string& oldPath, const string& newPath); +virtual bool ChangeDir(const string& dir); +virtual bool PrintWorkingDir(string& dir); +virtual bool ListDirContents(string& listing); +virtual bool Chmod(const string& path, const string& mod); + +virtual void SetPassive(bool on); + +protected: +status_t SetCommandLine(const char *command); +ssize_t SendCommand(const char *cmd); +ssize_t ReadReply(BString *to); +virtual status_t ParseReply(); + +int InputPipe() const { return fPty; }; +int OutputPipe() const { return fPty; }; + +private: +bool SpawnCommand(); +string fCommand; +pid_t fCommandPid; +int fPty; +}; + +#endif // SPAWNING_UPLOAD_CLIENT_H From mmu_man at mail.berlios.de Wed Jan 9 19:56:20 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 9 Jan 2008 19:56:20 +0100 Subject: [Haiku-commits] r23322 - haiku/trunk/src/apps/codycam Message-ID: <200801091856.m09IuKvV011049@sheep.berlios.de> Author: mmu_man Date: 2008-01-09 19:56:20 +0100 (Wed, 09 Jan 2008) New Revision: 23322 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23322&view=rev Modified: haiku/trunk/src/apps/codycam/FtpClient.cpp haiku/trunk/src/apps/codycam/VideoConsumer.cpp Log: sftp also needs chmod... Modified: haiku/trunk/src/apps/codycam/FtpClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/FtpClient.cpp 2008-01-09 18:51:55 UTC (rev 23321) +++ haiku/trunk/src/apps/codycam/FtpClient.cpp 2008-01-09 18:56:20 UTC (rev 23322) @@ -245,8 +245,6 @@ if (rc) { _GetReply(replyString, code, codeType); rc = codeType <= 2; - // at least BeOS' ftpd forces 640 which RobinHood doesn't like... - Chmod(remote, "644"); } return rc; Modified: haiku/trunk/src/apps/codycam/VideoConsumer.cpp =================================================================== --- haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-01-09 18:51:55 UTC (rev 23321) +++ haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-01-09 18:56:20 UTC (rev 23322) @@ -706,6 +706,10 @@ if (ftp->PutFile((string)filename, (string)"temp")) { // send the file to the server + + ftp->Chmod((string)filename, (string)"644"); + // make it world readable + UpdateFtpStatus("Renaming ..."); if (ftp->MoveFile((string)"temp", (string)filename)) { From fekdahl at gmail.com Wed Jan 9 20:06:49 2008 From: fekdahl at gmail.com (Fredrik Ekdahl) Date: Wed, 09 Jan 2008 20:06:49 +0100 Subject: [Haiku-commits] r23321 - haiku/trunk/src/apps/codycam In-Reply-To: <200801091851.m09IptwV010890@sheep.berlios.de> References: <200801091851.m09IptwV010890@sheep.berlios.de> Message-ID: <1199905609.6058.4.camel@ekdahl> ons 2008-01-09 klockan 19:51 +0100 skrev mmu_man at BerliOS: > Author: mmu_man > Date: 2008-01-09 19:51:55 +0100 (Wed, 09 Jan 2008) > New Revision: 23321 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23321&view=rev > > Added: > haiku/trunk/src/apps/codycam/SftpClient.cpp > haiku/trunk/src/apps/codycam/SftpClient.h > haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp > haiku/trunk/src/apps/codycam/SpawningUploadClient.h > Log: > Might work better with the files :))) > C++ generated/objects/haiku/x86/release/apps/codycam/SpawningUploadClient.o src/apps/codycam/SpawningUploadClient.cpp: In member function 'ssize_t SpawningUploadClient::ReadReply(BString*)': src/apps/codycam/SpawningUploadClient.cpp:101: error: 'errno' was not declared in this scope /media/data/develop/haiku/trunk/generated/cross-tools/bin/i586-pc-haiku-gcc -c "src/apps/codycam/SpawningUploadClient.cpp" -O -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -nostdinc -Wno-multichar -Wno-deprecated -D_ZETA_USING_DEPRECATED_API_=1 -D_ZETA_TS_FIND_DIR_=1 -D__HAIKU__ -DHAIKU_DISTRO_COMPATIBILITY_DEFAULT -D__INTEL__ -DARCH_x86 -DHAIKU_TARGET_PLATFORM_HAIKU -iquote src/apps/codycam -iquote generated/objects/common/apps/codycam -iquote generated/objects/linux/x86/common/apps/codycam -iquote generated/objects/haiku/x86/common/apps/codycam -I headers -I headers/posix -I headers/gnu -I headers/glibc -I headers/os -I headers/os/add-ons -I headers/os/add-ons/file_system -I headers/os/add-ons/graphics -I headers/os/add-ons/input_server -I headers/os/add-ons/registrar -I headers/os/add-ons/screen_saver -I headers/os/add-ons/tracker -I headers/os/app -I headers/os/device -I headers/os/drivers -I headers/os/game -I headers/os/interface -I headers/os/kernel -I headers/os/media -I headers/os/mail -I headers/os/midi -I headers/os/midi2 -I headers/os/net -I headers/os/opengl -I headers/os/storage -I headers/os/support -I headers/os/translation -I headers/private/. -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2 -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/i586-pc-haiku -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/backward -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/../../../../include/c++/4.1.2/ext -I /media/data/develop/haiku/trunk/generated/cross-tools/lib/gcc/i586-pc-haiku/4.1.2/include -o "generated/objects/haiku/x86/release/apps/codycam/SpawningUploadClient.o" ; ...failed C++ generated/objects/haiku/x86/release/apps/codycam/SpawningUploadClient.o ... From julun at mail.berlios.de Wed Jan 9 20:13:29 2008 From: julun at mail.berlios.de (julun at BerliOS) Date: Wed, 9 Jan 2008 20:13:29 +0100 Subject: [Haiku-commits] r23323 - haiku/trunk/src/apps/codycam Message-ID: <200801091913.m09JDTQw012089@sheep.berlios.de> Author: julun Date: 2008-01-09 20:13:29 +0100 (Wed, 09 Jan 2008) New Revision: 23323 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23323&view=rev Modified: haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp Log: fix the build Modified: haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp 2008-01-09 18:56:20 UTC (rev 23322) +++ haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp 2008-01-09 19:13:29 UTC (rev 23323) @@ -1,3 +1,4 @@ +#include #include #include #include From marcusoverhagen at mail.berlios.de Wed Jan 9 20:26:05 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 20:26:05 +0100 Subject: [Haiku-commits] r23324 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801091926.m09JQ5Dv012711@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 20:26:05 +0100 (Wed, 09 Jan 2008) New Revision: 23324 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23324&view=rev Removed: haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/queuing.c Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/dma.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c Log: Rewrote bus state functions, commented out much code to make it compile. Moved bus_reset from basic_protocol.c into ata.c Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 19:13:29 UTC (rev 23323) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 19:26:05 UTC (rev 23324) @@ -16,6 +16,7 @@ #include "ide_cmds.h" #define TRACE dprintf +#define FLOW dprintf void ata_select_device(ide_bus_info *bus, int device) @@ -30,6 +31,17 @@ } +void +ata_select(ide_device_info *device) +{ +// ata_select_device(device->bus, device->is_device1); + + + ASSERT(device->is_device1 == device->tf.chs.device); + device->bus->controller->write_command_block_regs(device->bus->channel_cookie, &device->tf, ide_mask_device_head); +} + + bool ata_is_device_present(ide_bus_info *bus, int device) { @@ -51,23 +63,261 @@ } -/* +/** busy-wait for device + * set - bits of status register that must be set + * cleared - bits of status register that must be cleared + * check_err - abort if error bit is set + * timeout - waiting timeout + */ +status_t +ata_wait(ide_bus_info *bus, uint8 set, uint8 cleared, + bool check_err, bigtime_t timeout) +{ + bigtime_t startTime = system_time(); + bigtime_t elapsedTime; + uint8 status; -void -ata_select_device(ide_device_info *device) + spin(1); // device needs 400ns to set status + + for (;;) { + status = bus->controller->get_altstatus(bus->channel_cookie); + + if (check_err && (status & ide_status_err) != 0) + return B_ERROR; + + if ((status & set) == set && (status & cleared) == 0) + return B_OK; + + elapsedTime = system_time() - startTime; + + if (elapsedTime > timeout) + return B_TIMED_OUT; + + if (elapsedTime < 5000) + spin(1); + else + snooze(5000); + } +} + + +// busy-wait for data request going high +status_t +ata_wait_for_drq(ide_bus_info *bus) { + return ata_wait(bus, ide_status_drq, 0, true, 10000000); +} + + +// busy-wait for data request going low +status_t +ata_wait_for_drqdown(ide_bus_info *bus) +{ + return ata_wait(bus, 0, ide_status_drq, true, 1000000); +} + + +// busy-wait for device ready +status_t +ata_wait_for_drdy(ide_bus_info *bus) +{ + return ata_wait(bus, ide_status_drdy, ide_status_bsy, false, 5000000); +} + + +status_t +ata_send_command(ide_device_info *device, ide_qrequest *qrequest, + bool need_drdy, uint32 timeout, ata_bus_state new_state) +{ + ide_bus_info *bus = device->bus; + + ASSERT((device->tf_param_mask & ide_mask_command) == 0); + ASSERT(new_state == ata_state_pio || new_state == ata_state_dma); + ASSERT(bus->state == ata_state_busy); + + ASSERT(new_state == ata_state_pio); // XXX only pio for now + + FAST_LOGN(bus->log, ev_ide_send_command, 15, device->is_device1, (uint32)qrequest, + device->tf.raw.r[0], device->tf.raw.r[1], device->tf.raw.r[2], + device->tf.raw.r[3], device->tf.raw.r[4], device->tf.raw.r[5], + device->tf.raw.r[6], + device->tf.raw.r[7], device->tf.raw.r[8], device->tf.raw.r[9], + device->tf.raw.r[10], device->tf.raw.r[11]); + + TRACE("ata_send_command: qrequest %p, request %p\n", qrequest, qrequest ? qrequest->request : NULL); + + // disable Interrupts for PIO transfers + if (new_state == ata_state_pio) { + if (bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3 | ide_devctrl_nien) != B_OK) + goto err; + } + + ata_select(device); + + bus->active_device = device; + + if (ata_wait(bus, 0, ide_status_bsy | ide_status_drq, false, 50000) != B_OK) { + // resetting the device here will discard current configuration, + // it's better when the SCSI bus manager requests an external reset. + TRACE("device selection timeout\n"); + device->subsys_status = SCSI_SEL_TIMEOUT; + return B_ERROR; + } + + if (need_drdy && (bus->controller->get_altstatus(bus->channel_cookie) & ide_status_drdy) == 0) { + TRACE("drdy not set\n"); + device->subsys_status = SCSI_SEQUENCE_FAIL; + return B_ERROR; + } + + // write parameters + if (bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, device->tf_param_mask) != B_OK) + goto err; + + FLOW("Writing command 0x%02x", (int)device->tf.write.command); + + IDE_LOCK(bus); + + if (new_state == ata_state_dma) { + if (bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3) != B_OK) + goto err_clearint; + } + + // start the command + if (bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_command) != B_OK) + goto err_clearint; + + ASSERT(bus->state == ata_state_busy); + + bus->state = new_state; + + IDE_UNLOCK(bus); + + return B_OK; + + + +err_clearint: + bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3 | ide_devctrl_nien); + +err: + device->subsys_status = SCSI_HBA_ERR; + IDE_UNLOCK(bus); + return B_ERROR; +} + + +status_t +ata_reset_bus(ide_bus_info *bus, bool *_devicePresent0, uint32 *_sigDev0, bool *_devicePresent1, uint32 *_sigDev1) +{ + ide_controller_interface *controller = bus->controller; + ide_channel_cookie channel = bus->channel_cookie; + bool devicePresent0; + bool devicePresent1; ide_task_file tf; - tf.chs.head = 0; - tf.chs.mode = ide_mode_lba; - tf.chs.device = device->is_device1; + status_t status; - device->bus->controller->read_command_block_regs(device->bus->channel_cookie, &tf, - ide_mask_device_head); - spin(1); // wait 400 nsec + dprintf("ATA: reset_bus %p\n", bus); + + devicePresent0 = ata_is_device_present(bus, 0); + devicePresent1 = ata_is_device_present(bus, 1); + + dprintf("ATA: reset_bus: ata_is_device_present device 0, present %d\n", devicePresent0); + dprintf("ATA: reset_bus: ata_is_device_present device 1, present %d\n", devicePresent1); + + // disable interrupts and assert SRST for at least 5 usec + if (controller->write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien | ide_devctrl_srst) != B_OK) + goto error; + spin(20); + + // clear SRST and wait for at least 2 ms but (we wait 150ms like everyone else does) + if (controller->write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien) != B_OK) + goto error; + snooze(150000); + + if (devicePresent0) { + + ata_select_device(bus, 0); + dprintf("altstatus device 0: %x\n", controller->get_altstatus(channel)); + + // wait up to 31 seconds for busy to clear, abort when error is set + status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); + if (status != B_OK) { + dprintf("ATA: reset_bus: timeout\n"); + goto error; + } + + if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | + ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high | ide_mask_error) != B_OK) + goto error; + + if (tf.read.error != 0x01 && tf.read.error != 0x81) + dprintf("ATA: device 0 failed, error code is 0x%02x\n", tf.read.error); + + if (tf.read.error >= 0x80) + dprintf("ATA: device 0 indicates that device 1 failed, error code is 0x%02x\n", tf.read.error); + + if (_sigDev0) { + *_sigDev0 = tf.lba.sector_count; + *_sigDev0 |= ((uint32)tf.lba.lba_0_7) << 8; + *_sigDev0 |= ((uint32)tf.lba.lba_8_15) << 16; + *_sigDev0 |= ((uint32)tf.lba.lba_16_23) << 24; + } + } + + if (devicePresent1) { + + ata_select_device(bus, 1); + dprintf("altstatus device 1: %x\n", controller->get_altstatus(channel)); + + // wait up to 31 seconds for busy to clear, abort when error is set + status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); + if (status != B_OK) { + dprintf("ATA: reset_bus: timeout\n"); + goto error; + } + + if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | + ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high | ide_mask_error) != B_OK) + goto error; + + if (tf.read.error != 0x01) + dprintf("ATA: device 1 failed, error code is 0x%02x\n", tf.read.error); + + if (_sigDev1) { + *_sigDev1 = tf.lba.sector_count; + *_sigDev1 |= ((uint32)tf.lba.lba_0_7) << 8; + *_sigDev1 |= ((uint32)tf.lba.lba_8_15) << 16; + *_sigDev1 |= ((uint32)tf.lba.lba_16_23) << 24; + } + } + + if (_devicePresent0) + *_devicePresent0 = devicePresent0; + if (_devicePresent1) + *_devicePresent1 = devicePresent1; + + dprintf("ATA: reset_bus done\n"); + return B_OK; + +error: + dprintf("ATA: reset_bus failed\n"); + return B_ERROR; } -*/ +status_t +ata_reset_device(ide_device_info *device, bool *_devicePresent) +{ + // XXX first try to reset the single device here + + dprintf("ATA: ata_reset_device %p calling ata_reset_bus\n", device); + return ata_reset_bus(device->bus, + device->is_device1 ? NULL : _devicePresent, NULL, + device->is_device1 ? _devicePresent : NULL, NULL); +} + + /** verify that device is ready for further PIO transmission */ static bool @@ -92,6 +342,7 @@ } +#if 0 /** DPC called at * - begin of each PIO read/write block * - end of PUI write transmission @@ -140,7 +391,7 @@ // so we better start waiting too early; as we are in service thread, // a DPC initiated by IRQ cannot overtake us, so there is no need to block // IRQs during sent - start_waiting_nolock(device->bus, timeout, ide_state_async_waiting); + start_waiting_nolock(device->bus, timeout, ata_state_async_waiting); // having a too short data buffer shouldn't happen here // anyway - we are prepared @@ -152,7 +403,7 @@ } else { if (device->left_blocks > 1) { // start async waiting for next command (see above) - start_waiting_nolock(device->bus, timeout, ide_state_async_waiting); + start_waiting_nolock(device->bus, timeout, ata_state_async_waiting); } // see write @@ -183,7 +434,7 @@ finish_checksense(qrequest); } - +#endif /** DPC called when IRQ was fired at end of DMA transmission */ void @@ -358,19 +609,6 @@ if (!prepare_dma(device, qrequest)) { // fall back to PIO on error -/* - // if command queueing is used and there is another command - // already running, we cannot fallback to PIO immediately -> declare - // command as not queuable and resubmit it, so the scsi bus manager - // will block other requests on retry - // (XXX this is not fine if the caller wants to recycle the CCB) - if (device->num_running_reqs > 1) { - qrequest->request->flags &= ~SCSI_ORDERED_QTAG; - finish_retry(qrequest); - return; - } -*/ - qrequest->uses_dma = false; } } @@ -388,12 +626,8 @@ timeout = qrequest->request->timeout > 0 ? qrequest->request->timeout : IDE_STD_TIMEOUT; - // in DMA mode, we continue with "accessing", - // on PIO read, we continue with "async waiting" - // on PIO write, we continue with "accessing" - if (!send_command(device, qrequest, !device->is_atapi, timeout, - (!qrequest->uses_dma && !qrequest->is_write) ? - ide_state_async_waiting : ide_state_accessing)) + if (ata_send_command(device, qrequest, !device->is_atapi, timeout, + qrequest->uses_dma ? ata_state_dma : ata_state_pio) != B_OK) goto err_send; if (qrequest->uses_dma) { @@ -439,6 +673,7 @@ bool check_rw_error(ide_device_info *device, ide_qrequest *qrequest) { +#if 0 ide_bus_info *bus = device->bus; uint8 status; @@ -503,7 +738,7 @@ set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_INTERNAL_FAILURE); return true; } - +#endif return false; } @@ -518,6 +753,7 @@ check_output(ide_device_info *device, bool drdy_required, int error_mask, bool is_write) { +#if 0 ide_bus_info *bus = device->bus; uint8 status; @@ -602,7 +838,7 @@ set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_INTERNAL_FAILURE); return false; } - +#endif return true; } @@ -614,23 +850,27 @@ static bool device_set_feature(ide_device_info *device, int feature) { +#if 0 device->tf_param_mask = ide_mask_features; device->tf.write.features = feature; device->tf.write.command = IDE_CMD_SET_FEATURES; - if (!send_command(device, NULL, true, 1, ide_state_sync_waiting)) + if (!send_command(device, NULL, true, 1, ata_state_sync_waiting)) return false; wait_for_sync(device->bus); return check_output(device, true, ide_error_abrt, false); +#endif + return true; } static bool configure_rmsn(ide_device_info *device) { +#if 0 ide_bus_info *bus = device->bus; int i; @@ -652,7 +892,7 @@ device->tf_param_mask = 0; device->tf.write.command = IDE_CMD_GET_MEDIA_STATUS; - if (!send_command(device, NULL, true, 15, ide_state_sync_waiting)) + if (!send_command(device, NULL, true, 15, ata_state_sync_waiting)) continue; if (check_output(device, true, @@ -663,6 +903,8 @@ } return false; +#endif + return true; } @@ -758,25 +1000,12 @@ TRACE("ata_read_infoblock: bus %p, device %d, isAtapi %d\n", device->bus, device->is_device1, isAtapi); - // disable interrupts - bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3 | ide_devctrl_nien); + ata_select(device); - // initialize device selection flags, - // this is the only place where this bit gets initialized in the task file - if (bus->controller->read_command_block_regs(bus->channel_cookie, &device->tf, - ide_mask_device_head) != B_OK) { - TRACE("ata_read_infoblock: read_command_block_regs failed\n"); - goto error; - } - - ata_select_device(device->bus, device->is_device1); - - device->tf.lba.device = device->is_device1; // XXX fix me - device->tf_param_mask = 0; device->tf.write.command = isAtapi ? IDE_CMD_IDENTIFY_PACKET_DEVICE : IDE_CMD_IDENTIFY_DEVICE; - if (!send_command(device, NULL, isAtapi ? false : true, 20, ide_state_accessing)) { + if (ata_send_command(device, NULL, isAtapi ? false : true, 20, ata_state_pio) != B_OK) { TRACE("ata_read_infoblock: send_command failed\n"); goto error; } @@ -790,14 +1019,13 @@ bus->controller->read_pio(bus->channel_cookie, (uint16 *)&device->infoblock, sizeof(device->infoblock) / sizeof(uint16), false); - if (!wait_for_drqdown(device)) { - TRACE("ata_read_infoblock: wait_for_drqdown failed\n"); + if (ata_wait_for_drqdown(bus) != B_OK) { + TRACE("ata_read_infoblock: ata_wait_for_drqdown failed\n"); goto error; } IDE_LOCK(bus); - bus->state = ide_state_idle; - cancel_timer(&bus->timer.te); + bus->state = ata_state_idle; IDE_UNLOCK(bus); TRACE("ata_read_infoblock: success\n"); @@ -805,8 +1033,7 @@ error: IDE_LOCK(bus); - bus->state = ide_state_idle; - cancel_timer(&bus->timer.te); + bus->state = ata_state_idle; IDE_UNLOCK(bus); return B_ERROR; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-09 19:13:29 UTC (rev 23323) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-09 19:26:05 UTC (rev 23324) @@ -92,6 +92,7 @@ void packet_dpc(ide_qrequest *qrequest) { +#if 0 ide_device_info *device = qrequest->device; ide_bus_info *bus = device->bus; int status; @@ -259,6 +260,7 @@ cancel_irq_timeout(device->bus); err: finish_checksense(qrequest); +#endif } @@ -288,6 +290,7 @@ void send_packet(ide_device_info *device, ide_qrequest *qrequest, bool write) { +#if 0 ide_bus_info *bus = device->bus; bool packet_irq = device->atapi.packet_irq; uint8 scsi_cmd = device->packet[0]; @@ -431,6 +434,7 @@ abort_dma(device, qrequest); finish_checksense(qrequest); +#endif } Deleted: haiku/trunk/src/add-ons/kernel/bus_managers/ata/basic_protocol.c Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-09 19:13:29 UTC (rev 23323) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-09 19:26:05 UTC (rev 23324) @@ -123,13 +123,23 @@ device->qreqActive = NULL; device->qreqFree = (ide_qrequest *)malloc(sizeof(ide_qrequest)); + memset(device->qreqFree, 0, sizeof(ide_qrequest)); device->qreqFree->running = false; device->qreqFree->device = device; device->qreqFree->request = NULL; + device->total_sectors = 0; - device->total_sectors = 0; + // disable interrupts + bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3 | ide_devctrl_nien); + + // make sure LBA bit is set, and initialize device selection flag + device->tf.chs.head = 0; + device->tf.chs.mode = ide_mode_lba; + device->tf.chs.device = is_device1; + bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_device_head); + return device; err: Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/dma.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/dma.c 2008-01-09 19:13:29 UTC (rev 23323) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/dma.c 2008-01-09 19:26:05 UTC (rev 23324) @@ -60,6 +60,9 @@ device->DMA_enabled = device->DMA_supported = device->bus->can_DMA && get_device_dma_mode(device) != -1; + dprintf("XXX DISABLING DMA\n"); + device->DMA_enabled = false; + return true; } @@ -102,12 +105,14 @@ void start_dma_wait(ide_device_info *device, ide_qrequest *qrequest) { +#if 0 ide_bus_info *bus = device->bus; bus->controller->start_dma(bus->channel_cookie); start_waiting(bus, qrequest->request->timeout > 0 ? qrequest->request->timeout : IDE_STD_TIMEOUT, ide_state_async_waiting); +#endif } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-09 19:13:29 UTC (rev 23323) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-09 19:26:05 UTC (rev 23324) @@ -169,13 +169,13 @@ // state of ide bus typedef enum { - ide_state_idle, // noone is using it, but overlapped - // commands may be pending - ide_state_accessing, // bus is in use - ide_state_async_waiting, // waiting for IRQ, to be reported via irq_dpc - ide_state_sync_waiting, // waiting for IRQ, to be reported via sync_wait_sem -} ide_bus_state; + ata_state_idle, // not is using it + ata_state_busy, // got bus but no command issued yet + ata_state_pio, // bus is executing a PIO command + ata_state_dma // bus is executing a DMA command +} ata_bus_state; + struct ide_bus_info { ide_qrequest *active_qrequest; @@ -187,13 +187,12 @@ spinlock lock; cpu_status prev_irq_state; - ide_bus_state state; // current state of bus + ata_bus_state state; // current state of bus benaphore status_report_ben; // to lock when you report XPT about bus state // i.e. during requeue, resubmit or finished bool disconnected; // true, if controller is lost - int num_running_reqs; // total number of running requests scsi_bus scsi_cookie; // cookie for scsi bus @@ -201,9 +200,6 @@ scsi_dpc_cookie irq_dpc; ide_synced_pc *synced_pc_list; - sem_id sync_wait_sem; // released when sync_wait finished - bool sync_wait_timeout; // true, if timeout occured - ide_device_info *active_device; ide_device_info *devices[2]; ide_device_info *first_device; @@ -302,11 +298,17 @@ // ata.c -//void ata_select_device(ide_device_info *device); void ata_select_device(ide_bus_info *bus, int device); +void ata_select(ide_device_info *device); bool ata_is_device_present(ide_bus_info *bus, int device); +status_t ata_wait(ide_bus_info *bus, uint8 set, uint8 not_set, bool check_err, bigtime_t timeout); +status_t ata_wait_for_drq(ide_bus_info *bus); +status_t ata_wait_for_drqdown(ide_bus_info *bus); +status_t ata_wait_for_drdy(ide_bus_info *bus); +status_t ata_reset_bus(ide_bus_info *bus, bool *_devicePresent0, uint32 *_sigDev0, bool *_devicePresent1, uint32 *_sigDev1); +status_t ata_reset_device(ide_device_info *device, bool *_devicePresent); +status_t ata_send_command(ide_device_info *device, ide_qrequest *qrequest, bool need_drdy, uint32 timeout, ata_bus_state new_state); - bool check_rw_error(ide_device_info *device, ide_qrequest *qrequest); bool check_output(ide_device_info *device, bool drdy_required, int error_mask, bool is_write); @@ -331,26 +333,8 @@ // basic_prot.c -status_t ata_wait(ide_bus_info *bus, uint8 mask, uint8 not_mask, bool check_err, bigtime_t timeout); - - -bool ide_wait(ide_device_info *device, int mask, int not_mask, bool check_err, - bigtime_t timeout); -bool wait_for_drq(ide_device_info *device); -bool wait_for_drqdown(ide_device_info *device); -bool wait_for_drdy(ide_device_info *device); - // timeout in seconds -bool send_command(ide_device_info *device, ide_qrequest *qrequest, - bool need_drdy, uint32 timeout, ide_bus_state new_state); -//bool reset_device(ide_device_info *device, ide_qrequest *ignore); -//bool reset_bus(ide_device_info *device, ide_qrequest *ignore); - -bool check_service_req(ide_device_info *device); -status_t reset_bus(ide_bus_info *bus, bool *devicePresent0, uint32 *sigDev0, bool *devicePresent1, uint32 *sigDev1); - - // channel_mgr.c extern ide_for_controller_interface ide_for_controller_module; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 19:13:29 UTC (rev 23323) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 19:26:05 UTC (rev 23324) @@ -110,17 +110,15 @@ ACQUIRE_BEN(&bus->status_report_ben); IDE_LOCK(bus); - if (bus->state != ide_state_idle) + if (bus->state != ata_state_idle) goto err_bus_busy; // bail out if device can't accept further requests if (device->qreqFree == NULL) goto err_device_busy; - bus->state = ide_state_accessing; + bus->state = ata_state_busy; - ++bus->num_running_reqs; - IDE_UNLOCK(bus); RELEASE_BEN(&bus->status_report_ben); @@ -239,7 +237,7 @@ destroy_device(bus->devices[i]); } - status = reset_bus(bus, &devicePresent[0], &deviceSignature[0], &devicePresent[1], &deviceSignature[1]); + status = ata_reset_bus(bus, &devicePresent[0], &deviceSignature[0], &devicePresent[1], &deviceSignature[1]); for (i = 0; i < bus->max_devices; ++i) { if (!devicePresent[i]) @@ -303,6 +301,7 @@ if (bus->disconnected) return SCSI_NO_HBA; + return SCSI_REQ_INVALID; } @@ -382,8 +381,6 @@ device->qreqFree = device->qreqActive; device->qreqActive = NULL; - --bus->num_running_reqs; // XXX borked!!! - // paranoia bus->active_qrequest = NULL; @@ -514,7 +511,6 @@ finish_all_requests(ide_device_info *device, ide_qrequest *ignore, int subsys_status, bool resubmit) { - int i; if (device == NULL) return; @@ -558,7 +554,6 @@ memset(bus, 0, sizeof(*bus)); bus->node = node; bus->lock = 0; - bus->num_running_reqs = 0; bus->active_qrequest = NULL; bus->disconnected = false; @@ -581,7 +576,7 @@ init_synced_pc(&bus->disconnect_syncinfo, disconnect_worker); bus->scsi_cookie = user_cookie; - bus->state = ide_state_idle; + bus->state = ata_state_idle; bus->timer.bus = bus; bus->synced_pc_list = NULL; @@ -589,11 +584,6 @@ goto err1; bus->active_device = NULL; - bus->sync_wait_sem = create_sem(0, "ide_sync_wait"); - if (bus->sync_wait_sem < 0) { - status = bus->sync_wait_sem; - goto err2; - } bus->devices[0] = bus->devices[1] = NULL; @@ -642,13 +632,6 @@ *cookie = bus; -/* - // make sure LBA bit is set - bus->controller->read_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_device_head); - tf.chs.mode = ide_mode_lba; - bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_device_head); -*/ - // detect devices scan_bus(bus); return B_OK; @@ -656,9 +639,6 @@ err5: DELETE_BEN(&bus->status_report_ben); err4: -err3: - delete_sem(bus->sync_wait_sem); -err2: scsi->free_dpc(bus->irq_dpc); err1: uninit_synced_pc(&bus->disconnect_syncinfo); @@ -684,7 +664,6 @@ pnp->put_device_node(parent); DELETE_BEN(&bus->status_report_ben); - delete_sem(bus->sync_wait_sem); scsi->free_dpc(bus->irq_dpc); uninit_synced_pc(&bus->disconnect_syncinfo); // fast_log->stop_log(bus->log); Deleted: haiku/trunk/src/add-ons/kernel/bus_managers/ata/queuing.c Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-09 19:13:29 UTC (rev 23323) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-09 19:26:05 UTC (rev 23324) @@ -205,6 +205,7 @@ static bool ata_test_unit_ready(ide_device_info *device, ide_qrequest *qrequest) { +#if 0 SHOW_FLOW0(3, ""); if (!device->infoblock.RMSN_supported @@ -229,6 +230,7 @@ ; } +#endif return true; } @@ -237,6 +239,7 @@ static bool ata_flush_cache(ide_device_info *device, ide_qrequest *qrequest) { +#if 0 // we should also ask for FLUSH CACHE support, but everyone denies it // (looks like they cheat to gain some performance advantage, but // that's pretty useless: everyone does it...) @@ -254,6 +257,8 @@ wait_for_sync(device->bus); return check_output(device, true, ide_error_abrt, false); +#endif + return false; } @@ -263,6 +268,7 @@ static bool ata_load_eject(ide_device_info *device, ide_qrequest *qrequest, bool load) { +#if 0 if (load) { // ATA doesn't support loading set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_PARAM_NOT_SUPPORTED); @@ -278,6 +284,8 @@ wait_for_sync(device->bus); return check_output(device, true, ide_error_abrt | ide_error_nm, false); +#endif + return false; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c 2008-01-09 19:13:29 UTC (rev 23323) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c 2008-01-09 19:26:05 UTC (rev 23324) @@ -30,6 +30,7 @@ void ide_dpc(void *arg) { +#if 0 ide_bus_info *bus = (ide_bus_info *)arg; ide_qrequest *qrequest; ide_device_info *device; @@ -88,6 +89,7 @@ /*err: xpt->cont_send( bus->xpt_cookie );*/ +#endif } @@ -96,17 +98,10 @@ status_t ide_irq_handler(ide_bus_info *bus, uint8 status) { + return B_UNHANDLED_INTERRUPT; +/* ide_device_info *device; - // we need to lock bus to have a solid bus state - // (side effect: we lock out the timeout handler and get - // delayed if the IRQ happens at the same time as a command is - // issued; in the latter case, we have no official way to determine - // whether the command was issued before or afterwards; if it was - // afterwards, the device must not be busy; if it was before, - // the device is either busy because of the sent command, or it's - // not busy as the command has already been finished, i.e. there - // was a second IRQ which we've overlooked as we didn't acknowledge // the first IRQ) IDE_LOCK(bus); @@ -180,14 +175,17 @@ return B_UNHANDLED_INTERRUPT; } +*/ } + /** cancel IRQ timeout * it doesn't matter whether there really was a timout running; * on return, bus state is set to _accessing_ */ +/* void cancel_irq_timeout(ide_bus_info *bus) { @@ -201,9 +199,8 @@ } -/** start waiting for IRQ with bus lock hold - * new_state must be either sync_wait or async_wait - */ +// start waiting for IRQ with bus lock hold +// new_state must be either sync_wait or async_wait void start_waiting(ide_bus_info *bus, uint32 timeout, int new_state) @@ -226,7 +223,7 @@ } -/** start waiting for IRQ with bus lock not hold */ +// start waiting for IRQ with bus lock not hold void start_waiting_nolock(ide_bus_info *bus, uint32 timeout, int new_state) @@ -236,7 +233,7 @@ } -/** wait for sync IRQ */ +// wait for sync IRQ void wait_for_sync(ide_bus_info *bus) @@ -244,10 +241,10 @@ acquire_sem(bus->sync_wait_sem); cancel_timer(&bus->timer.te); } +*/ +// timeout dpc handler -/** timeout dpc handler */ - static void ide_timeout_dpc(void *arg) { @@ -280,19 +277,16 @@ } -/** timeout handler, called by system timer */ +// timeout handler, called by system timer status_t ide_timeout(timer *arg) { ide_bus_info *bus = ((ide_bus_timer_info *)arg)->bus; - FAST_LOG0(bus->log, ev_ide_timeout); - - TRACE(("ide_timeout(): %p\n", bus)); - [... truncated: 47 lines follow ...] From mmu_man at mail.berlios.de Wed Jan 9 20:29:35 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 9 Jan 2008 20:29:35 +0100 Subject: [Haiku-commits] r23325 - haiku/trunk/src/apps/codycam Message-ID: <200801091929.m09JTZJI012888@sheep.berlios.de> Author: mmu_man Date: 2008-01-09 20:29:35 +0100 (Wed, 09 Jan 2008) New Revision: 23325 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23325&view=rev Modified: haiku/trunk/src/apps/codycam/SftpClient.cpp haiku/trunk/src/apps/codycam/VideoConsumer.cpp Log: sftp doesn't allow renaming to an existing file, so remove it first. Modified: haiku/trunk/src/apps/codycam/SftpClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/SftpClient.cpp 2008-01-09 19:26:05 UTC (rev 23324) +++ haiku/trunk/src/apps/codycam/SftpClient.cpp 2008-01-09 19:29:35 UTC (rev 23325) @@ -167,17 +167,39 @@ { bool rc = false; int len; - BString cmd("rename"); - cmd << " " << oldPath.c_str() << " " << newPath.c_str() << "\n"; + + // sftpd can't rename to an existing file... + BString cmd("rm"); + cmd << " " << newPath.c_str() << "\n"; SendCommand(cmd.String()); BString reply; + if ((len = ReadReply(&reply)) < 0) { fprintf(stderr, "read: %s\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); + if (reply.FindFirst("Removing") != 0) + return false; + + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %s\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); if (reply.FindFirst("sftp>") < 0) return false; + + cmd = "rename"; + cmd << " " << oldPath.c_str() << " " << newPath.c_str() << "\n"; + SendCommand(cmd.String()); + if ((len = ReadReply(&reply)) < 0) { + fprintf(stderr, "read: %s\n", len); + return false; + } + fprintf(stderr, "reply: '%s'\n", reply.String()); + if (reply.FindFirst("sftp>") < 0) + return false; rc = true; return rc; } Modified: haiku/trunk/src/apps/codycam/VideoConsumer.cpp =================================================================== --- haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-01-09 19:26:05 UTC (rev 23324) +++ haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-01-09 19:29:35 UTC (rev 23325) @@ -707,7 +707,7 @@ if (ftp->PutFile((string)filename, (string)"temp")) { // send the file to the server - ftp->Chmod((string)filename, (string)"644"); + ftp->Chmod((string)"temp", (string)"644"); // make it world readable UpdateFtpStatus("Renaming ..."); From marcusoverhagen at mail.berlios.de Wed Jan 9 20:35:03 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 20:35:03 +0100 Subject: [Haiku-commits] r23326 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801091935.m09JZ3c6013458@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 20:35:03 +0100 (Wed, 09 Jan 2008) New Revision: 23326 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23326&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c Log: removed fast_log usage Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile 2008-01-09 19:29:35 UTC (rev 23325) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile 2008-01-09 19:35:03 UTC (rev 23326) @@ -7,7 +7,6 @@ KernelAddon ide : ata.c atapi.c - basic_protocol.c channels.c devices.c dma.c @@ -15,7 +14,6 @@ ide.c ide_sim.c pio.c - queuing.c scsi2ata.c sync.c virtual_memory.c Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 19:29:35 UTC (rev 23325) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 19:35:03 UTC (rev 23326) @@ -137,15 +137,14 @@ ASSERT(new_state == ata_state_pio); // XXX only pio for now - FAST_LOGN(bus->log, ev_ide_send_command, 15, device->is_device1, (uint32)qrequest, + FLOW("ata_send_command: %d:%d, qrequest %p, request %p, tf %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n", + device->target_id, device->is_device1, + qrequest, qrequest ? qrequest->request : NULL, device->tf.raw.r[0], device->tf.raw.r[1], device->tf.raw.r[2], device->tf.raw.r[3], device->tf.raw.r[4], device->tf.raw.r[5], - device->tf.raw.r[6], - device->tf.raw.r[7], device->tf.raw.r[8], device->tf.raw.r[9], - device->tf.raw.r[10], device->tf.raw.r[11]); + device->tf.raw.r[6], device->tf.raw.r[7], device->tf.raw.r[8], + device->tf.raw.r[9], device->tf.raw.r[10], device->tf.raw.r[11]); - TRACE("ata_send_command: qrequest %p, request %p\n", qrequest, qrequest ? qrequest->request : NULL); - // disable Interrupts for PIO transfers if (new_state == ata_state_pio) { if (bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3 | ide_devctrl_nien) != B_OK) Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-09 19:29:35 UTC (rev 23325) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-09 19:35:03 UTC (rev 23326) @@ -17,7 +17,6 @@ #include "ide_device_infoblock.h" #include #include -#include #define debug_level_error 2 #define debug_level_info 1 @@ -28,24 +27,6 @@ #include "wrapper.h" -//#define USE_FAST_LOG - -#ifdef USE_FAST_LOG -#define FAST_LOG0( handle, event ) fast_log->log_0( handle, event ) -#define FAST_LOG1( handle, event, param ) fast_log->log_1( handle, event, param ) -#define FAST_LOG2( handle, event, param1, param2 ) fast_log->log_2( handle, event, param1, param2 ) -#define FAST_LOG3( handle, event, param1, param2, param3 ) fast_log->log_3( handle, event, param1, param2, param3 ) -#define FAST_LOGN( handle, event, num_params... ) fast_log->log_n( handle, event, num_params ) -#else -#define FAST_LOG0( handle, event ) -#define FAST_LOG1( handle, event, param ) -#define FAST_LOG2( handle, event, param1, param2 ) -#define FAST_LOG3( handle, event, param1, param2, param3 ) -#define FAST_LOGN( handle, event, num_params... ) -#endif - - - #define IDE_STD_TIMEOUT 10 #define IDE_RELEASE_TIMEOUT 10000000 @@ -58,7 +39,6 @@ #define IDE_CHANNEL_ID_ITEM "ide/channel_id" extern device_manager_info *pnp; -extern fast_log_info *fast_log; typedef struct ide_bus_info ide_bus_info; @@ -215,7 +195,6 @@ uint8 can_DMA; uint8 can_CQ; - fast_log_handle log; char name[32]; }; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 19:29:35 UTC (rev 23325) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 19:35:03 UTC (rev 23326) @@ -37,43 +37,8 @@ scsi_for_sim_interface *scsi; -fast_log_info *fast_log; -#ifdef USE_FAST_LOG -static fast_log_event_type ide_events[] = -{ - { ev_ide_send_command, "ev_ide_send_command " }, - { ev_ide_device_start_service, "ev_ide_device_start_service" }, - { ev_ide_device_start_service2, "ev_ide_device_start_service2" }, - { ev_ide_dpc_service, "ev_ide_dpc_service" }, - { ev_ide_dpc_continue, "ev_ide_dpc_continue" }, - { ev_ide_irq_handle, "ev_ide_irq_handle" }, - { ev_ide_cancel_irq_timeout, "ev_ide_cancel_irq_timeout" }, - { ev_ide_start_waiting, "ev_ide_start_waiting" }, - { ev_ide_timeout_dpc, "ev_ide_timeout_dpc" }, - { ev_ide_timeout, "ev_ide_timeout" }, - { ev_ide_reset_bus, "ev_ide_reset_bus" }, - { ev_ide_reset_device, "ev_ide_reset_device" }, - - { ev_ide_scsi_io, "ev_ide_scsi_io" }, - { ev_ide_scsi_io_exec, "ev_ide_scsi_io_exec" }, - { ev_ide_scsi_io_invalid_device, "ev_ide_scsi_io_invalid_device" }, - { ev_ide_scsi_io_bus_busy, "ev_ide_scsi_io_bus_busy" }, - { ev_ide_scsi_io_device_busy, "ev_ide_scsi_io_device_busy" }, - { ev_ide_scsi_io_disconnected, "ev_ide_scsi_io_disconnected" }, - { ev_ide_finish_request, "ev_ide_finish_request" }, - { ev_ide_finish_norelease, "ev_ide_finish_norelease" }, - - { ev_ide_scan_device_int, "ev_ide_scan_device_int" }, - { ev_ide_scan_device_int_cant_send, "ev_ide_scan_device_int_cant_send" }, - { ev_ide_scan_device_int_keeps_busy, "ev_ide_scan_device_int_keeps_busy" }, - { ev_ide_scan_device_int_found, "ev_ide_scan_device_int_found" }, - {} -}; -#endif - - static void disconnect_worker(ide_bus_info *bus, void *arg); static void set_check_condition(ide_qrequest *qrequest); @@ -85,8 +50,6 @@ ide_qrequest *qrequest; //ide_request_priv *priv; -// FAST_LOG3( bus->log, ev_ide_scsi_io, (uint32)request, request->target_id, request->target_lun ); -// SHOW_FLOW(3, "%d:%d", request->target_id, request->target_lun); FLOW("sim_scsi_iobus %p, %d:%d\n", bus, request->target_id, request->target_lun); if (bus->disconnected) @@ -133,16 +96,15 @@ bus->active_qrequest = qrequest; // XXX whats this!?!?! - FAST_LOGN(bus->log, ev_ide_scsi_io_exec, 4, (uint32)qrequest, - (uint32)request, bus->num_running_reqs, device->num_running_reqs); + FLOW("calling exec_io: %p, %d:%d\n", bus, request->target_id, request->target_lun); + device->exec_io(device, qrequest); return; err_inv_device: FLOW("Invalid device %d:%d\n", request->target_id, request->target_lun); - FAST_LOG1(bus->log, ev_ide_scsi_io_invalid_device, (uint32)request); request->subsys_status = SCSI_SEL_TIMEOUT; scsi->finished(request, 1); @@ -150,7 +112,6 @@ err_bus_busy: FLOW("Bus busy\n"); - FAST_LOG1(bus->log, ev_ide_scsi_io_bus_busy, (uint32)request); IDE_UNLOCK(bus); scsi->requeue(request, true); @@ -159,7 +120,6 @@ err_device_busy: FLOW("Device busy\n"); - FAST_LOG1(bus->log, ev_ide_scsi_io_device_busy, (uint32)request); IDE_UNLOCK(bus); scsi->requeue(request, false); @@ -168,7 +128,6 @@ err_disconnected: TRACE("No controller anymore\n"); - FAST_LOG1(bus->log, ev_ide_scsi_io_disconnected, (uint32)request); request->subsys_status = SCSI_NO_HBA; scsi->finished(request, 1); return; @@ -369,7 +328,6 @@ ide_bus_info *bus = device->bus; scsi_ccb *request; - FAST_LOG2(bus->log, ev_ide_finish_request, (uint32)qrequest, resubmit); SHOW_FLOW0(3, ""); // save request first, as qrequest can be reused as soon as @@ -481,7 +439,6 @@ ide_device_info *device = qrequest->device; ide_bus_info *bus = device->bus; - FAST_LOG2(bus->log, ev_ide_finish_norelease, (uint32)qrequest, resubmit); qrequest->running = false; @@ -565,13 +522,6 @@ sprintf(bus->name, "ide_bus %d", (int)channel_id); } -#if 0 - bus->log = fast_log->start_log(bus->name, ide_events); - if (bus->log == NULL) { - res = B_NO_MEMORY; - goto err; - } -#endif init_synced_pc(&bus->disconnect_syncinfo, disconnect_worker); @@ -642,10 +592,7 @@ scsi->free_dpc(bus->irq_dpc); err1: uninit_synced_pc(&bus->disconnect_syncinfo); -#ifdef USE_FAST_LOG - fast_log->stop_log(bus->log); err: -#endif free(bus); return status; @@ -666,7 +613,6 @@ DELETE_BEN(&bus->status_report_ben); scsi->free_dpc(bus->irq_dpc); uninit_synced_pc(&bus->disconnect_syncinfo); -// fast_log->stop_log(bus->log); free(bus); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c 2008-01-09 19:29:35 UTC (rev 23325) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c 2008-01-09 19:35:03 UTC (rev 23326) @@ -43,7 +43,6 @@ // in idle state, so we just check whether there is an active request, // which means that we were async_waiting if (bus->active_qrequest != NULL) { - FAST_LOG1(bus->log, ev_ide_dpc_continue, (uint32)bus->active_qrequest); TRACE(("continue command\n")); // cancel timeout @@ -67,8 +66,6 @@ // for service requests TRACE(("irq in idle mode - possible service request\n")); - FAST_LOG0(bus->log, ev_ide_dpc_service); - device = get_current_device(bus); if (device == NULL) { // got an interrupt from a non-existing device @@ -189,8 +186,6 @@ void cancel_irq_timeout(ide_bus_info *bus) { - FAST_LOG0(bus->log, ev_ide_cancel_irq_timeout); - IDE_LOCK(bus); bus->state = ide_state_accessing; IDE_UNLOCK(bus); @@ -207,8 +202,6 @@ { int res; - FAST_LOG1(bus->log, ev_ide_start_waiting, new_state); - TRACE(("timeout = %u\n", (uint)timeout)); bus->state = new_state; @@ -257,8 +250,6 @@ dprintf("ide: ide_timeout_dpc() bus %p, device %p\n", bus, device); - FAST_LOG1(bus->log, ev_ide_timeout_dpc, (uint32)qrequest); - // this also resets overlapped commands // reset_device(device, qrequest); From marcusoverhagen at mail.berlios.de Wed Jan 9 20:45:44 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 20:45:44 +0100 Subject: [Haiku-commits] r23327 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801091945.m09Jjip6014359@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 20:45:44 +0100 (Wed, 09 Jan 2008) New Revision: 23327 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23327&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c Log: set bus state to ata_state_busy during device scanning Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 19:35:03 UTC (rev 23326) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 19:45:44 UTC (rev 23327) @@ -1023,16 +1023,18 @@ goto error; } + // XXX fix me IDE_LOCK(bus); - bus->state = ata_state_idle; + bus->state = ata_state_busy; IDE_UNLOCK(bus); TRACE("ata_read_infoblock: success\n"); return B_OK; error: + // XXX fix me IDE_LOCK(bus); - bus->state = ata_state_idle; + bus->state = ata_state_busy; IDE_UNLOCK(bus); return B_ERROR; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 19:35:03 UTC (rev 23326) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 19:45:44 UTC (rev 23327) @@ -191,6 +191,14 @@ if (bus->disconnected) return; + + // XXX fix me + IDE_LOCK(bus); + ASSERT(bus->state == ata_state_idle); + bus->state = ata_state_busy; + IDE_UNLOCK(bus); + + for (i = 0; i < bus->max_devices; ++i) { if (bus->devices[i]) destroy_device(bus->devices[i]); @@ -220,6 +228,13 @@ } } + + // XXX fix me + IDE_LOCK(bus); + ASSERT(bus->state == ata_state_busy); + bus->state = ata_state_idle; + IDE_UNLOCK(bus); + TRACE("ATA: scan_bus: bus %p finished\n", bus); } From stippi at mail.berlios.de Wed Jan 9 20:46:54 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 9 Jan 2008 20:46:54 +0100 Subject: [Haiku-commits] r23328 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200801091946.m09Jkshw014427@sheep.berlios.de> Author: stippi Date: 2008-01-09 20:46:54 +0100 (Wed, 09 Jan 2008) New Revision: 23328 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23328&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.h Log: mmlr+stippi+axeld: * changed the way the interrupt schedules and repeats are handled, the input server thread (via ioctl) is now triggering the scheduling and processing of usb interrupt transfers. As long as it is blocking on the usb_callback semaphore, it is using it as timeout for the key repeats. -> no more deadlock because the driver is issuing usb commands from within the usb_callback function (hotplugging should be fixed when using the Haiku usb stack) -> the driver is no longer installing one timer per key down event -> simplifications Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-09 19:45:44 UTC (rev 23327) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-09 19:46:54 UTC (rev 23328) @@ -339,7 +339,7 @@ device->open = 0; device->open_fds = NULL; device->active = true; - device->unplugged = false; + device->transfer_scheduled = false; device->insns = NULL; device->num_insns = 0; device->flags = 0; @@ -355,7 +355,6 @@ // default values taken from the PS/2 driver device->repeat_rate = 35000; device->repeat_delay = 300000; - device->repeat_timer.device = device; return device; } @@ -365,7 +364,6 @@ remove_device(hid_device_info *device) { assert(device != NULL); - cancel_timer(&device->repeat_timer.timer); if (device->rbuf != NULL) { delete_ring_buffer(device->rbuf); @@ -388,31 +386,9 @@ raw.timestamp = system_time(); ring_buffer_write(device->rbuf, (const uint8*)&raw, sizeof(raw_key_info)); - release_sem_etc(device->sem_cb, 1, B_DO_NOT_RESCHEDULE); } -static int32 -timer_repeat_hook(struct timer *timer) -{ - hid_device_info *device = ((struct hid_repeat_timer *)timer)->device; - - write_key(device, device->repeat_timer.key, true); - return B_HANDLED_INTERRUPT; -} - - -static int32 -timer_delay_hook(struct timer *timer) -{ - hid_device_info *device = ((struct hid_repeat_timer *)timer)->device; - - add_timer(&device->repeat_timer.timer, timer_repeat_hook, device->repeat_rate, - B_PERIODIC_TIMER); - return B_HANDLED_INTERRUPT; -} - - // here we don't need to follow a report descriptor for typical keyboards // TODO : but we should for keypads for example because they aren't boot keyboard devices ! // see hidparse.c @@ -457,10 +433,8 @@ write_key(device, key, true); // repeat handling - cancel_timer(&device->repeat_timer.timer); device->repeat_timer.key = key; - add_timer(&device->repeat_timer.timer, timer_delay_hook, - device->repeat_delay, B_ONE_SHOT_RELATIVE_TIMER); + device->repeat_timer.current_delay = device->repeat_delay; } } else break; @@ -492,8 +466,10 @@ } write_key(device, key, false); + + // cancel the repeats if they are for this key if (device->repeat_timer.key == key) - cancel_timer(&device->repeat_timer.timer); + device->repeat_timer.current_delay = B_INFINITE_TIMEOUT; } } else break; @@ -590,10 +566,11 @@ info.timestamp = device->timestamp; ring_buffer_write(device->rbuf, (const uint8*)&info, sizeof(info)); - release_sem_etc(device->sem_cb, 1, B_DO_NOT_RESCHEDULE); } +// #pragma mark - interrupt transfers + /*! callback: got a report, issue next request */ @@ -602,21 +579,39 @@ void *data, size_t actualLength) { hid_device_info *device = cookie; - status_t status; - if (device == NULL || device->unplugged) - return; - - acquire_sem(device->sem_lock); device->actual_length = actualLength; device->bus_status = busStatus; /* B_USB_STATUS_* */ - if (busStatus != B_OK) { + + // release the notification semaphore so the input_server + // thread which is blocking in hid_device_control can continue + // to run (see you in handle_interrupt_transfer()) + release_sem_etc(device->sem_cb, 1, B_DO_NOT_RESCHEDULE); +} + +static status_t +schedule_interrupt_transfer(hid_device_info* device) +{ + status_t status = usb->queue_interrupt(device->ept->handle, device->buffer, + device->total_report_size, usb_callback, device); + if (status != B_OK) { + /* XXX probably endpoint stall */ + DPRINTF_ERR ((MY_ID "queue_interrupt() error %d\n", (int)status)); + } + return status; +} + +static status_t +handle_interrupt_transfer(hid_device_info* device) +{ + status_t status = device->bus_status; + + if (status != B_OK) { /* request failed */ - release_sem(device->sem_lock); - DPRINTF_ERR((MY_ID "bus status %d\n", (int)busStatus)); - if (busStatus == B_CANCELED) { + DPRINTF_ERR((MY_ID "bus status %d\n", (int)device->bus_status)); + if (status == B_CANCELED) { /* cancelled: device is unplugged */ - return; + return status; } #if 1 status = usb->clear_feature(device->ept->handle, USB_FEATURE_ENDPOINT_HALT); @@ -641,18 +636,9 @@ memcpy(device->last_buffer, device->buffer, device->total_report_size); } else interpret_mouse_buffer(device); - - release_sem(device->sem_lock); } - /* issue next request */ - - status = usb->queue_interrupt(device->ept->handle, device->buffer, - device->total_report_size, usb_callback, device); - if (status != B_OK) { - /* XXX probably endpoint stall */ - DPRINTF_ERR ((MY_ID "queue_interrupt() error %d\n", (int)status)); - } + return status; } @@ -841,15 +827,7 @@ DPRINTF_INFO ((MY_ID "%08lx %08lx %08lx\n", *(((uint32*)device->buffer)), *(((uint32*)device->buffer)+1), *(((uint32*)device->buffer)+2))); - /* issue interrupt transfer */ - device->ept = &intf->endpoint[0]; /* interrupt IN */ - status = usb->queue_interrupt(device->ept->handle, device->buffer, - device->total_report_size, usb_callback, device); - if (status != B_OK) { - DPRINTF_ERR ((MY_ID "queue_interrupt() error %d\n", (int)status)); - return B_ERROR; - } /* create a port */ @@ -870,7 +848,6 @@ DPRINTF_INFO((MY_ID "device_removed(%s)\n", device->name)); - device->unplugged = true; usb->cancel_queued_transfers (device->ept->handle); remove_device_info(device); @@ -950,14 +927,43 @@ if (device->is_keyboard) switch (op) { case KB_READ: - err = acquire_sem_etc(device->sem_cb, 1, B_CAN_INTERRUPT, 0LL); - if (err != B_OK) - return err; - acquire_sem(device->sem_lock); + while (ring_buffer_readable(device->rbuf) == 0) { + if (!device->transfer_scheduled) { + err = schedule_interrupt_transfer(device); + if (err != B_OK) + return err; + device->transfer_scheduled = true; + // NOTE: this thread is now blocking until + // the semaphore will be released from the + // call_back function + } + + err = acquire_sem_etc(device->sem_cb, 1, + B_CAN_INTERRUPT | B_RELATIVE_TIMEOUT, + device->repeat_timer.current_delay); + if (err == B_TIMED_OUT) { + // this case is for handling key repeats, it means + // no interrupt transfer has happened + write_key(device, device->repeat_timer.key, true); + // the next timeout is reduced to the repeat_rate + device->repeat_timer.current_delay = device->repeat_rate; + } else if (err == B_OK) { + // this case is for when an actual interrupt transfer + // happened, it is the only possible reason to be here + device->transfer_scheduled = false; + err = handle_interrupt_transfer(device); + if (err != B_OK) + return err; + } else { + return err; + } + } + + // process what is in the ring_buffer, it could be written + // there because we handled an interrupt transfer or because + // we wrote the current repeat key ring_buffer_user_read(device->rbuf, arg, sizeof(raw_key_info)); - release_sem(device->sem_lock); - return err; - break; + return B_OK; case KB_SET_LEDS: set_leds(device, (uint8 *)arg); @@ -966,9 +972,21 @@ else switch (op) { case MS_READ: + err = schedule_interrupt_transfer(device); + if (err != B_OK) + return err; + // NOTE: this thread is now blocking until + // the semaphore will be released from the + // call_back function + err = acquire_sem_etc(device->sem_cb, 1, B_CAN_INTERRUPT, 0LL); if (err != B_OK) return err; + + err = handle_interrupt_transfer(device); + if (err != B_OK) + return err; + acquire_sem(device->sem_lock); ring_buffer_user_read(device->rbuf, arg, sizeof(mouse_movement)); release_sem(device->sem_lock); Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.h 2008-01-09 19:45:44 UTC (rev 23327) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.h 2008-01-09 19:46:54 UTC (rev 23328) @@ -45,8 +45,7 @@ struct driver_cookie; struct hid_repeat_timer { - struct timer timer; - struct hid_device_info *device; + bigtime_t current_delay; uint32 key; }; @@ -68,7 +67,6 @@ struct ring_buffer *rbuf; bool active; - bool unplugged; int open; struct driver_cookie *open_fds; @@ -76,6 +74,7 @@ int usbd_status, bus_status, cmd_status; int actual_length; const usb_endpoint_info *ept; + bool transfer_scheduled; report_insn *insns; size_t num_insns; From korli at mail.berlios.de Wed Jan 9 22:05:51 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 9 Jan 2008 22:05:51 +0100 Subject: [Haiku-commits] r23329 - haiku/trunk/src/apps/codycam Message-ID: <200801092105.m09L5ppC022788@sheep.berlios.de> Author: korli Date: 2008-01-09 22:05:50 +0100 (Wed, 09 Jan 2008) New Revision: 23329 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23329&view=rev Modified: haiku/trunk/src/apps/codycam/SftpClient.cpp Log: fix warnings Modified: haiku/trunk/src/apps/codycam/SftpClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/SftpClient.cpp 2008-01-09 19:46:54 UTC (rev 23328) +++ haiku/trunk/src/apps/codycam/SftpClient.cpp 2008-01-09 21:05:50 UTC (rev 23329) @@ -26,7 +26,7 @@ cmd << " " << dir.c_str() << "\n"; SendCommand(cmd.String()); if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %s\n", len); + fprintf(stderr, "read: %d\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); @@ -46,7 +46,7 @@ BString reply; do { if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %s\n", len); + fprintf(stderr, "read: %d\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); @@ -82,7 +82,7 @@ ssize_t len; if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %d\n", len); + fprintf(stderr, "read: %ld\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); @@ -90,7 +90,7 @@ return false; if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %s\n", len); + fprintf(stderr, "read: %ld\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); @@ -101,7 +101,7 @@ write(OutputPipe(), "\n", 1); if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %s\n", len); + fprintf(stderr, "read: %ld\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); @@ -109,7 +109,7 @@ return false; if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %s\n", len); + fprintf(stderr, "read: %ld\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); @@ -131,7 +131,7 @@ BString reply; if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %s\n", len); + fprintf(stderr, "read: %d\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); @@ -139,7 +139,7 @@ return false; if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %s\n", len); + fprintf(stderr, "read: %d\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); @@ -175,7 +175,7 @@ BString reply; if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %s\n", len); + fprintf(stderr, "read: %d\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); @@ -183,7 +183,7 @@ return false; if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %s\n", len); + fprintf(stderr, "read: %d\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); @@ -194,7 +194,7 @@ cmd << " " << oldPath.c_str() << " " << newPath.c_str() << "\n"; SendCommand(cmd.String()); if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %s\n", len); + fprintf(stderr, "read: %d\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); @@ -217,7 +217,7 @@ BString reply; if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %s\n", len); + fprintf(stderr, "read: %d\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); @@ -225,7 +225,7 @@ return false; if ((len = ReadReply(&reply)) < 0) { - fprintf(stderr, "read: %s\n", len); + fprintf(stderr, "read: %d\n", len); return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); From stippi at mail.berlios.de Wed Jan 9 22:26:05 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 9 Jan 2008 22:26:05 +0100 Subject: [Haiku-commits] r23330 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200801092126.m09LQ5HN023722@sheep.berlios.de> Author: stippi Date: 2008-01-09 22:26:05 +0100 (Wed, 09 Jan 2008) New Revision: 23330 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23330&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c Log: * applied the same logic with regards to the ringbuffer to the mouse case in the ioctl() hook. Should be considered work in progress. Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-09 21:05:50 UTC (rev 23329) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-09 21:26:05 UTC (rev 23330) @@ -924,7 +924,7 @@ if (!device->active) return B_ERROR; /* already unplugged */ - if (device->is_keyboard) + if (device->is_keyboard) { switch (op) { case KB_READ: while (ring_buffer_readable(device->rbuf) == 0) { @@ -969,36 +969,33 @@ set_leds(device, (uint8 *)arg); break; } - else + } else { switch (op) { case MS_READ: - err = schedule_interrupt_transfer(device); - if (err != B_OK) - return err; - // NOTE: this thread is now blocking until - // the semaphore will be released from the - // call_back function + while (ring_buffer_readable(device->rbuf) == 0) { + err = schedule_interrupt_transfer(device); + if (err != B_OK) + return err; + // NOTE: this thread is now blocking until + // the semaphore will be released from the + // call_back function + + err = acquire_sem_etc(device->sem_cb, 1, B_CAN_INTERRUPT, 0LL); + if (err != B_OK) + return err; + + err = handle_interrupt_transfer(device); + if (err != B_OK) + return err; + } - err = acquire_sem_etc(device->sem_cb, 1, B_CAN_INTERRUPT, 0LL); - if (err != B_OK) - return err; - - err = handle_interrupt_transfer(device); - if (err != B_OK) - return err; - - acquire_sem(device->sem_lock); ring_buffer_user_read(device->rbuf, arg, sizeof(mouse_movement)); - release_sem(device->sem_lock); - return err; - break; + return B_OK; + case MS_NUM_EVENTS: - { - int32 count; - get_sem_count(device->sem_cb, &count); - return count; - break; - } + return (int32)(ring_buffer_readable(device->rbuf) + / sizeof(mouse_movement)); + case MS_SET_CLICKSPEED: #ifdef __HAIKU__ return user_memcpy(&device->click_speed, arg, sizeof(bigtime_t)); @@ -1011,6 +1008,7 @@ /* not implemented */ break; } + } return err; } From marcusoverhagen at mail.berlios.de Wed Jan 9 22:58:24 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Wed, 9 Jan 2008 22:58:24 +0100 Subject: [Haiku-commits] r23331 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801092158.m09LwOUg025978@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-09 22:58:23 +0100 (Wed, 09 Jan 2008) New Revision: 23331 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23331&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/dma.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/emulation.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/pio.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/sync.c Log: Renamed ide_qrequest *qrequest into ata_request *request. Removed synced pcs. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 21:26:05 UTC (rev 23330) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 21:58:23 UTC (rev 23331) @@ -126,7 +126,7 @@ status_t -ata_send_command(ide_device_info *device, ide_qrequest *qrequest, +ata_send_command(ide_device_info *device, ata_request *request, bool need_drdy, uint32 timeout, ata_bus_state new_state) { ide_bus_info *bus = device->bus; @@ -137,9 +137,9 @@ ASSERT(new_state == ata_state_pio); // XXX only pio for now - FLOW("ata_send_command: %d:%d, qrequest %p, request %p, tf %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n", + FLOW("ata_send_command: %d:%d, request %p, ccb %p, tf %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n", device->target_id, device->is_device1, - qrequest, qrequest ? qrequest->request : NULL, + request, request ? request->ccb : NULL, device->tf.raw.r[0], device->tf.raw.r[1], device->tf.raw.r[2], device->tf.raw.r[3], device->tf.raw.r[4], device->tf.raw.r[5], device->tf.raw.r[6], device->tf.raw.r[7], device->tf.raw.r[8], @@ -348,25 +348,25 @@ */ void -ata_dpc_PIO(ide_qrequest *qrequest) +ata_dpc_PIO(ata_request *request) { - ide_device_info *device = qrequest->device; - uint32 timeout = qrequest->request->timeout > 0 ? - qrequest->request->timeout : IDE_STD_TIMEOUT; + ide_device_info *device = request->device; + uint32 timeout = request->ccb->timeout > 0 ? + request->ccb->timeout : IDE_STD_TIMEOUT; SHOW_FLOW0(3, ""); - if (check_rw_error(device, qrequest) - || !check_rw_status(device, qrequest->is_write ? device->left_blocks > 0 : true)) + if (check_rw_error(device, request) + || !check_rw_status(device, request->is_write ? device->left_blocks > 0 : true)) { // failure reported by device SHOW_FLOW0( 3, "command finished unsuccessfully" ); - finish_checksense(qrequest); + finish_checksense(request); return; } - if (qrequest->is_write) { + if (request->is_write) { if (device->left_blocks == 0) { // this was the end-of-transmission IRQ SHOW_FLOW0(3, "write access finished"); @@ -395,7 +395,7 @@ // having a too short data buffer shouldn't happen here // anyway - we are prepared SHOW_FLOW0(3, "Writing one block"); - if (write_PIO_block(qrequest, 512) == B_ERROR) + if (write_PIO_block(request, 512) == B_ERROR) goto finish_cancel_timeout; --device->left_blocks; @@ -407,13 +407,13 @@ // see write SHOW_FLOW0( 3, "Reading one block" ); - if (read_PIO_block(qrequest, 512) == B_ERROR) + if (read_PIO_block(request, 512) == B_ERROR) goto finish_cancel_timeout; --device->left_blocks; if (device->left_blocks == 0) { - // at end of transmission, wait for data request going low + // at end of transmission, wait for data ccb going low SHOW_FLOW0( 3, "Waiting for device to finish transmission" ); if (!wait_for_drqdown(device)) @@ -430,26 +430,26 @@ cancel_irq_timeout(device->bus); finish: - finish_checksense(qrequest); + finish_checksense(request); } #endif /** DPC called when IRQ was fired at end of DMA transmission */ void -ata_dpc_DMA(ide_qrequest *qrequest) +ata_dpc_DMA(ata_request *request) { - ide_device_info *device = qrequest->device; + ide_device_info *device = request->device; bool dma_success, dev_err; dma_success = finish_dma(device); - dev_err = check_rw_error(device, qrequest); + dev_err = check_rw_error(device, request); if (dma_success && !dev_err) { // reset error count if DMA worked device->DMA_failures = 0; - qrequest->request->data_resid = 0; - finish_checksense(qrequest); + request->ccb->data_resid = 0; + finish_checksense(request); } else { SHOW_ERROR0( 2, "Error in DMA transmission" ); @@ -461,20 +461,20 @@ } // reset queue in case queuing is active - finish_reset_queue(qrequest); + finish_reset_queue(request); } } // list of LBA48 opcodes -static uint8 cmd_48[2][2] = { +static const uint8 cmd_48[2][2] = { { IDE_CMD_READ_SECTORS_EXT, IDE_CMD_WRITE_SECTORS_EXT }, { IDE_CMD_READ_DMA_EXT, IDE_CMD_WRITE_DMA_EXT } }; // list of normal LBA opcodes -static uint8 cmd_28[2][2] = { +static const uint8 cmd_28[2][2] = { { IDE_CMD_READ_SECTORS, IDE_CMD_WRITE_SECTORS }, { IDE_CMD_READ_DMA, IDE_CMD_WRITE_DMA } }; @@ -483,7 +483,7 @@ /** create IDE read/write command */ static bool -create_rw_taskfile(ide_device_info *device, ide_qrequest *qrequest, +create_rw_taskfile(ide_device_info *device, ata_request *request, uint64 pos, size_t length, bool write) { SHOW_FLOW0( 3, "" ); @@ -514,7 +514,7 @@ device->tf.lba48.lba_24_31 = (pos >> 24) & 0xff; device->tf.lba48.lba_32_39 = (pos >> 32) & 0xff; device->tf.lba48.lba_40_47 = (pos >> 40) & 0xff; - device->tf.lba48.command = cmd_48[qrequest->uses_dma][write]; + device->tf.lba48.command = cmd_48[request->uses_dma][write]; return true; } else { // normal LBA @@ -536,7 +536,7 @@ device->tf.lba.lba_8_15 = (pos >> 8) & 0xff; device->tf.lba.lba_16_23 = (pos >> 16) & 0xff; device->tf.lba.lba_24_27 = (pos >> 24) & 0xf; - device->tf.lba.command = cmd_28[qrequest->uses_dma][write]; + device->tf.lba.command = cmd_28[request->uses_dma][write]; return true; } } else { @@ -576,7 +576,7 @@ device->tf.chs.sector_number = (cylinder_offset % infoblock->current_sectors + 1) & 0xff; device->tf.chs.head = cylinder_offset / infoblock->current_sectors; - device->tf.chs.command = cmd_28[qrequest->uses_dma][write]; + device->tf.chs.command = cmd_28[request->uses_dma][write]; return true; } @@ -594,44 +594,44 @@ */ void -ata_send_rw(ide_device_info *device, ide_qrequest *qrequest, +ata_send_rw(ide_device_info *device, ata_request *request, uint64 pos, size_t length, bool write) { ide_bus_info *bus = device->bus; uint32 timeout; // make a copy first as settings may get changed by user during execution - qrequest->is_write = write; - qrequest->uses_dma = device->DMA_enabled; + request->is_write = write; + request->uses_dma = device->DMA_enabled; - if (qrequest->uses_dma) { - if (!prepare_dma(device, qrequest)) { + if (request->uses_dma) { + if (!prepare_dma(device, request)) { // fall back to PIO on error - qrequest->uses_dma = false; + request->uses_dma = false; } } - if (!qrequest->uses_dma) { - prep_PIO_transfer(device, qrequest); + if (!request->uses_dma) { + prep_PIO_transfer(device, request); device->left_blocks = length; } // compose command - if (!create_rw_taskfile(device, qrequest, pos, length, write)) + if (!create_rw_taskfile(device, request, pos, length, write)) goto err_setup; // if no timeout is specified, use standard - timeout = qrequest->request->timeout > 0 ? - qrequest->request->timeout : IDE_STD_TIMEOUT; + timeout = request->ccb->timeout > 0 ? + request->ccb->timeout : IDE_STD_TIMEOUT; - if (ata_send_command(device, qrequest, !device->is_atapi, timeout, - qrequest->uses_dma ? ata_state_dma : ata_state_pio) != B_OK) + if (ata_send_command(device, request, !device->is_atapi, timeout, + request->uses_dma ? ata_state_dma : ata_state_pio) != B_OK) goto err_send; - if (qrequest->uses_dma) { + if (request->uses_dma) { - start_dma_wait_no_lock(device, qrequest); + start_dma_wait_no_lock(device, request); } else { // on PIO read, we start with waiting, on PIO write we can // transmit data immediately; we let the service thread do @@ -639,7 +639,7 @@ // immediately (this optimisation really pays on SMP systems // only) SHOW_FLOW0(3, "Ready for PIO"); - if (qrequest->is_write) { + if (request->is_write) { SHOW_FLOW0(3, "Scheduling write DPC"); scsi->schedule_dpc(bus->scsi_cookie, bus->irq_dpc, ide_dpc, bus); } @@ -649,19 +649,19 @@ err_setup: // error during setup - if (qrequest->uses_dma) - abort_dma(device, qrequest); + if (request->uses_dma) + abort_dma(device, request); - finish_checksense(qrequest); + finish_checksense(request); return; err_send: // error during/after send; - // in this case, the device discards queued request automatically - if (qrequest->uses_dma) - abort_dma(device, qrequest); + // in this case, the device discards queued ccb automatically + if (request->uses_dma) + abort_dma(device, request); - finish_reset_queue(qrequest); + finish_reset_queue(request); } @@ -670,7 +670,7 @@ */ bool -check_rw_error(ide_device_info *device, ide_qrequest *qrequest) +check_rw_error(ide_device_info *device, ata_request *request) { #if 0 ide_bus_info *bus = device->bus; @@ -694,7 +694,7 @@ return true; } - if (qrequest->is_write) { + if (request->is_write) { if ((error & ide_error_wp) != 0) { set_sense(device, SCSIS_KEY_DATA_PROTECT, SCSIS_ASC_WRITE_PROTECTED); return true; @@ -995,7 +995,6 @@ ata_read_infoblock(ide_device_info *device, bool isAtapi) { ide_bus_info *bus = device->bus; - int status; TRACE("ata_read_infoblock: bus %p, device %d, isAtapi %d\n", device->bus, device->is_device1, isAtapi); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-09 21:26:05 UTC (rev 23330) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-09 21:58:23 UTC (rev 23331) @@ -31,7 +31,7 @@ return: true - device reported error */ static bool -check_packet_error(ide_device_info *device, ide_qrequest *qrequest) +check_packet_error(ide_device_info *device, ata_request *request) { ide_bus_info *bus = device->bus; int status; @@ -78,7 +78,7 @@ // tell SCSI layer that sense must be requested // (we don't take care of auto-sense ourselve) device->subsys_status = SCSI_REQ_CMP_ERR; - qrequest->request->device_status = SCSI_STATUS_CHECK_CONDITION; + request->ccb->device_status = SCSI_STATUS_CHECK_CONDITION; // reset pending emulated sense - its overwritten by a real one device->combined_sense = 0; return true; @@ -90,14 +90,14 @@ /*! IRQ handler of packet transfer (executed as DPC) */ void -packet_dpc(ide_qrequest *qrequest) +packet_dpc(ata_request *request) { #if 0 - ide_device_info *device = qrequest->device; + ide_device_info *device = request->device; ide_bus_info *bus = device->bus; int status; - uint32 timeout = qrequest->request->timeout > 0 ? - qrequest->request->timeout : IDE_STD_TIMEOUT; + uint32 timeout = request->ccb->timeout > 0 ? + request->ccb->timeout : IDE_STD_TIMEOUT; SHOW_FLOW0(3, ""); @@ -106,9 +106,9 @@ status = bus->controller->get_altstatus(bus->channel_cookie); - if (qrequest->packet_irq) { + if (request->packet_irq) { // device requests packet - qrequest->packet_irq = false; + request->packet_irq = false; if (!device->tf.packet_res.cmd_or_data || device->tf.packet_res.input_or_output @@ -132,7 +132,7 @@ return; } - if (qrequest->uses_dma) { + if (request->uses_dma) { // DMA transmission finished bool dma_err, dev_err; @@ -142,13 +142,13 @@ SHOW_FLOW0(3, "DMA done"); dma_err = !finish_dma(device); - dev_err = check_packet_error(device, qrequest); + dev_err = check_packet_error(device, request); // what to do if both the DMA controller and the device reports an error? // let's assume that the DMA controller got problems because there was a // device error, so we ignore the dma error and use the device error instead if (dev_err) { - finish_checksense(qrequest); + finish_checksense(request); return; } @@ -159,8 +159,8 @@ device->DMA_failures = 0; // this is a lie, but there is no way to find out // how much has been transmitted - qrequest->request->data_resid = 0; - finish_checksense(qrequest); + request->ccb->data_resid = 0; + finish_checksense(request); } else { // DMA transmission went wrong set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_LUN_COM_FAILURE); @@ -171,7 +171,7 @@ device->DMA_enabled = false; } - finish_checksense(qrequest); + finish_checksense(request); } return; @@ -191,7 +191,7 @@ } // check whether transmission direction matches - if ((device->tf.packet_res.input_or_output ^ qrequest->is_write) == 0) { + if ((device->tf.packet_res.input_or_output ^ request->is_write) == 0) { SHOW_ERROR0(2, "data transmission in wrong way!?"); // TODO: hm, either the device is broken or the caller has specified @@ -202,9 +202,9 @@ // TODO: the device will abort next command with a reset condition // perhaps we should hide that by reading sense? SHOW_FLOW0(3, "Reset"); -// reset_device(device, qrequest); +// reset_device(device, request); - finish_checksense(qrequest); + finish_checksense(request); return; } @@ -224,9 +224,9 @@ start_waiting_nolock(device->bus, timeout, ide_state_async_waiting); if (device->tf.packet_res.input_or_output) - err = read_PIO_block(qrequest, length); + err = read_PIO_block(request, length); else - err = write_PIO_block(qrequest, length); + err = write_PIO_block(request, length); // only report "real" errors; // discarding data (ERR_TOO_BIG) can happen but is OK @@ -241,16 +241,16 @@ return; } else { // device has done job and doesn't want to transmit data anymore - // -> finish request + // -> finish ccb SHOW_FLOW0(3, "no data"); - check_packet_error(device, qrequest); + check_packet_error(device, request); SHOW_FLOW(3, "finished: %d of %d left", - (int)qrequest->request->data_resid, - (int)qrequest->request->data_length); + (int)request->ccb->data_resid, + (int)request->ccb->data_length); - finish_checksense(qrequest); + finish_checksense(request); return; } @@ -259,27 +259,27 @@ err_cancel_timer: cancel_irq_timeout(device->bus); err: - finish_checksense(qrequest); + finish_checksense(request); #endif } /*! Create taskfile for ATAPI packet */ static bool -create_packet_taskfile(ide_device_info *device, ide_qrequest *qrequest, +create_packet_taskfile(ide_device_info *device, ata_request *request, bool write) { - scsi_ccb *request = qrequest->request; + scsi_ccb *ccb = request->ccb; SHOW_FLOW(3, "DMA enabled=%d, uses_dma=%d, scsi_cmd=%x", - device->DMA_enabled, qrequest->uses_dma, device->packet[0]); + device->DMA_enabled, request->uses_dma, device->packet[0]); device->tf_param_mask = ide_mask_features | ide_mask_byte_count; - device->tf.packet.dma = qrequest->uses_dma; + device->tf.packet.dma = request->uses_dma; device->tf.packet.ovl = 0; - device->tf.packet.byte_count_0_7 = request->data_length & 0xff; - device->tf.packet.byte_count_8_15 = request->data_length >> 8; + device->tf.packet.byte_count_0_7 = ccb->data_length & 0xff; + device->tf.packet.byte_count_8_15 = ccb->data_length >> 8; device->tf.packet.command = IDE_CMD_PACKET; return true; @@ -288,14 +288,14 @@ /*! Send ATAPI packet */ void -send_packet(ide_device_info *device, ide_qrequest *qrequest, bool write) +send_packet(ide_device_info *device, ata_request *request, bool write) { #if 0 ide_bus_info *bus = device->bus; bool packet_irq = device->atapi.packet_irq; uint8 scsi_cmd = device->packet[0]; - SHOW_FLOW( 3, "qrequest=%p, command=%x", qrequest, scsi_cmd ); + SHOW_FLOW( 3, "request=%p, command=%x", request, scsi_cmd ); /*{ unsigned int i; @@ -309,47 +309,47 @@ device->packet[3], device->packet[4], device->packet[5], device->packet[6], device->packet[7], device->packet[8], device->packet[9], device->packet[10], device->packet[11], - qrequest->request->cdb_length); + request->ccb->cdb_length); //snooze( 1000000 ); - qrequest->is_write = write; - // if needed, mark first IRQ as being packet request IRQ - qrequest->packet_irq = packet_irq; + request->is_write = write; + // if needed, mark first IRQ as being packet ccb IRQ + request->packet_irq = packet_irq; // only READ/WRITE commands can use DMA // (the device may support it always, but IDE controllers don't // report how much data is transmitted, and this information is // crucial for the SCSI protocol) // special offer: let READ_CD commands use DMA too - qrequest->uses_dma = device->DMA_enabled + request->uses_dma = device->DMA_enabled && (scsi_cmd == SCSI_OP_READ_6 || scsi_cmd == SCSI_OP_WRITE_6 || scsi_cmd == SCSI_OP_READ_10 || scsi_cmd == SCSI_OP_WRITE_10 || scsi_cmd == SCSI_OP_READ_12 || scsi_cmd == SCSI_OP_WRITE_12 || scsi_cmd == SCSI_OP_READ_CD); // try preparing DMA, if that fails, fall back to PIO - if (qrequest->uses_dma) { + if (request->uses_dma) { SHOW_FLOW0(3, "0"); - if (!prepare_dma( device, qrequest)) - qrequest->uses_dma = false; + if (!prepare_dma( device, request)) + request->uses_dma = false; - SHOW_FLOW(3, "0->%d", qrequest->uses_dma); + SHOW_FLOW(3, "0->%d", request->uses_dma); } SHOW_FLOW0(3, "1"); - if (!qrequest->uses_dma) - prep_PIO_transfer(device, qrequest); + if (!request->uses_dma) + prep_PIO_transfer(device, request); SHOW_FLOW0(3, "2"); - if (!create_packet_taskfile(device, qrequest, write)) + if (!create_packet_taskfile(device, request, write)) goto err_setup; SHOW_FLOW0(3, "3"); - if (!send_command(device, qrequest, false, + if (!send_command(device, request, false, device->atapi.packet_irq_timeout, device->atapi.packet_irq ? ide_state_async_waiting : ide_state_accessing)) goto err_setup; @@ -407,15 +407,15 @@ goto err_packet2; } - if (qrequest->uses_dma) { + if (request->uses_dma) { SHOW_FLOW0( 3, "ready for DMA" ); // S/G table must already be setup - we hold the bus lock, so // we really have to hurry up - start_dma_wait(device, qrequest); + start_dma_wait(device, request); } else { - uint32 timeout = qrequest->request->timeout > 0 ? - qrequest->request->timeout : IDE_STD_TIMEOUT; + uint32 timeout = request->ccb->timeout > 0 ? + request->ccb->timeout : IDE_STD_TIMEOUT; start_waiting(bus, timeout, ide_state_async_waiting); } @@ -430,38 +430,38 @@ device->subsys_status = SCSI_HBA_ERR; err_setup: - if (qrequest->uses_dma) - abort_dma(device, qrequest); + if (request->uses_dma) + abort_dma(device, request); - finish_checksense(qrequest); + finish_checksense(request); #endif } /*! Execute SCSI I/O for atapi devices */ void -atapi_exec_io(ide_device_info *device, ide_qrequest *qrequest) +atapi_exec_io(ide_device_info *device, ata_request *request) { - scsi_ccb *request = qrequest->request; + scsi_ccb *ccb = request->ccb; - SHOW_FLOW(3, "command=%x", qrequest->request->cdb[0]); + SHOW_FLOW(3, "command=%x", request->ccb->cdb[0]); // ATAPI command packets are 12 bytes long; // if the command is shorter, remaining bytes must be padded with zeros memset(device->packet, 0, sizeof(device->packet)); - memcpy(device->packet, request->cdb, request->cdb_length); + memcpy(device->packet, ccb->cdb, ccb->cdb_length); - if (request->cdb[0] == SCSI_OP_REQUEST_SENSE && device->combined_sense) { + if (ccb->cdb[0] == SCSI_OP_REQUEST_SENSE && device->combined_sense) { // we have a pending emulated sense - return it on REQUEST SENSE - ide_request_sense(device, qrequest); - finish_checksense(qrequest); + ide_request_sense(device, request); + finish_checksense(request); } else { - // reset all error codes for new request - start_request(device, qrequest); + // reset all error codes for new ccb + start_request(device, request); // now we have an IDE packet - send_packet(device, qrequest, - (request->flags & SCSI_DIR_MASK) == SCSI_DIR_OUT); + send_packet(device, request, + (ccb->flags & SCSI_DIR_MASK) == SCSI_DIR_OUT); } } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-09 21:26:05 UTC (rev 23330) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-09 21:58:23 UTC (rev 23331) @@ -58,10 +58,6 @@ device->exec_io = NULL; cleanup_device_links(device); - - if (device->qreqActive) - dprintf("destroy_device: Warning request still active\n"); - free(device->qreqFree); free(device); } @@ -121,14 +117,6 @@ device->combined_sense = 0; - device->qreqActive = NULL; - device->qreqFree = (ide_qrequest *)malloc(sizeof(ide_qrequest)); - - memset(device->qreqFree, 0, sizeof(ide_qrequest)); - device->qreqFree->running = false; - device->qreqFree->device = device; - device->qreqFree->request = NULL; - device->total_sectors = 0; // disable interrupts @@ -141,10 +129,6 @@ bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_device_head); return device; - -err: - destroy_device(device); - return NULL; } #if B_HOST_IS_LENDIAN Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/dma.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/dma.c 2008-01-09 21:26:05 UTC (rev 23330) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/dma.c 2008-01-09 21:58:23 UTC (rev 23331) @@ -71,7 +71,7 @@ must be called _before_ start_dma_wait */ void -abort_dma(ide_device_info *device, ide_qrequest *qrequest) +abort_dma(ide_device_info *device, ata_request *request) { ide_bus_info *bus = device->bus; @@ -86,14 +86,14 @@ warning: doesn't set sense data on error */ bool -prepare_dma(ide_device_info *device, ide_qrequest *qrequest) +prepare_dma(ide_device_info *device, ata_request *request) { ide_bus_info *bus = device->bus; - scsi_ccb *request = qrequest->request; + scsi_ccb *ccb = request->ccb; status_t res; - res = bus->controller->prepare_dma(bus->channel_cookie, request->sg_list, - request->sg_count, qrequest->is_write); + res = bus->controller->prepare_dma(bus->channel_cookie, ccb->sg_list, + ccb->sg_count, request->is_write); if (res != B_OK) return false; @@ -103,27 +103,27 @@ /*! Start waiting for DMA to be finished */ void -start_dma_wait(ide_device_info *device, ide_qrequest *qrequest) +start_dma_wait(ide_device_info *device, ata_request *request) { #if 0 ide_bus_info *bus = device->bus; bus->controller->start_dma(bus->channel_cookie); - start_waiting(bus, qrequest->request->timeout > 0 ? - qrequest->request->timeout : IDE_STD_TIMEOUT, ide_state_async_waiting); + start_waiting(bus, request->ccb->timeout > 0 ? + request->ccb->timeout : IDE_STD_TIMEOUT, ide_state_async_waiting); #endif } /*! Start waiting for DMA to be finished with bus lock not hold */ void -start_dma_wait_no_lock(ide_device_info *device, ide_qrequest *qrequest) +start_dma_wait_no_lock(ide_device_info *device, ata_request *request) { ide_bus_info *bus = device->bus; IDE_LOCK(bus); - start_dma_wait(device, qrequest); + start_dma_wait(device, request); } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/emulation.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/emulation.c 2008-01-09 21:26:05 UTC (rev 23330) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/emulation.c 2008-01-09 21:58:23 UTC (rev 23331) @@ -18,10 +18,10 @@ /*! Emulate REQUEST SENSE */ void -ide_request_sense(ide_device_info *device, ide_qrequest *qrequest) +ide_request_sense(ide_device_info *device, ata_request *request) { - scsi_ccb *request = qrequest->request; - scsi_cmd_request_sense *cmd = (scsi_cmd_request_sense *)request->cdb; + scsi_ccb *ccb = request->ccb; + scsi_cmd_request_sense *cmd = (scsi_cmd_request_sense *)ccb->cdb; scsi_sense sense; uint32 transferSize; @@ -33,39 +33,39 @@ else memset(&sense, 0, sizeof(sense)); - copy_sg_data(request, 0, cmd->allocation_length, &sense, sizeof(sense), false); + copy_sg_data(ccb, 0, cmd->allocation_length, &sense, sizeof(sense), false); // reset sense information on read device->combined_sense = 0; transferSize = min(sizeof(sense), cmd->allocation_length); - transferSize = min(transferSize, request->data_length); + transferSize = min(transferSize, ccb->data_length); - request->data_resid = request->data_length - transferSize; + ccb->data_resid = ccb->data_length - transferSize; // normally, all flags are set to "success", but for Request Sense // this would have overwritten the sense we want to read device->subsys_status = SCSI_REQ_CMP; - request->device_status = SCSI_STATUS_GOOD; + ccb->device_status = SCSI_STATUS_GOOD; } -/*! Copy data between request data and buffer - request - request to copy data from/to - offset - offset of data in request - allocation_length- limit of request's data buffer according to CDB +/*! Copy data between ccb data and buffer + ccb - ccb to copy data from/to + offset - offset of data in ccb + allocation_length- limit of ccb's data buffer according to CDB buffer - data to copy data from/to size - number of bytes to copy - to_buffer - true: copy from request to buffer - false: copy from buffer to request - return: true, if data of request was large enough + to_buffer - true: copy from ccb to buffer + false: copy from buffer to ccb + return: true, if data of ccb was large enough */ bool -copy_sg_data(scsi_ccb *request, uint offset, uint allocationLength, +copy_sg_data(scsi_ccb *ccb, uint offset, uint allocationLength, void *buffer, int size, bool toBuffer) { - const physical_entry *sgList = request->sg_list; - int sgCount = request->sg_count; + const physical_entry *sgList = ccb->sg_list; + int sgCount = ccb->sg_count; int requestSize; SHOW_FLOW(3, "offset=%u, req_size_limit=%d, size=%d, sg_list=%p, sg_cnt=%d, %s buffer", @@ -81,8 +81,8 @@ if (sgCount == 0) return 0; - // remaining bytes we are allowed to copy from/to request - requestSize = min(allocationLength, request->data_length) - offset; + // remaining bytes we are allowed to copy from/to ccb + requestSize = min(allocationLength, ccb->data_length) - offset; // copy one S/G entry at a time for (; size > 0 && requestSize > 0 && sgCount > 0; ++sgList, --sgCount) { Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-09 21:26:05 UTC (rev 23330) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-09 21:58:23 UTC (rev 23331) @@ -37,21 +37,16 @@ #define IDE_CHANNEL_ID_GENERATOR "ide/channel_id" // node item containing channel id (uint32) #define IDE_CHANNEL_ID_ITEM "ide/channel_id" +// SIM interface +#define IDE_SIM_MODULE_NAME "bus_managers/ide/sim/v1" + extern device_manager_info *pnp; typedef struct ide_bus_info ide_bus_info; -typedef void (*ide_synced_pc_func)(ide_bus_info *bus, void *arg); -typedef struct ide_synced_pc { - struct ide_synced_pc *next; - ide_synced_pc_func func; - void *arg; - bool registered; -} ide_synced_pc; - // structure for device time-outs typedef struct ide_device_timer_info { timer te; @@ -64,7 +59,19 @@ struct ide_bus_info *bus; } ide_bus_timer_info; +// ide request +typedef struct ata_request { + struct ide_device_info *device; + + scsi_ccb *ccb; // basic request + uint8 is_write : 1; // true for write request + uint8 uses_dma : 1; // true if using dma + uint8 packet_irq : 1; // true if waiting for command packet irq +} ata_request; + + + typedef struct ide_device_info { struct ide_bus_info *bus; @@ -87,13 +94,10 @@ // pending error codes uint32 combined_sense; // emulated sense of device - struct ide_qrequest *qreqActive; - struct ide_qrequest *qreqFree; - struct ide_device_info *other_device; // other device on same bus // entry for scsi's exec_io request - void (*exec_io)( struct ide_device_info *device, struct ide_qrequest *qrequest ); + void (*exec_io)( struct ide_device_info *device, struct ata_request *request ); int target_id; // target id (currently, same as is_device1) @@ -134,19 +138,7 @@ ide_request_autosense = 2 } ide_request_state;*/ -// ide request -typedef struct ide_qrequest { - struct ide_qrequest *next; - ide_device_info *device; - scsi_ccb *request; // basic request - uint8 is_write : 1; // true for write request - uint8 running : 1; // true if "on bus" - uint8 uses_dma : 1; // true if using dma - uint8 packet_irq : 1; // true if waiting for command packet irq -} ide_qrequest; - - // state of ide bus typedef enum { ata_state_idle, // not is using it @@ -157,7 +149,6 @@ struct ide_bus_info { - ide_qrequest *active_qrequest; // controller ide_controller_interface *controller; @@ -167,8 +158,12 @@ spinlock lock; cpu_status prev_irq_state; - ata_bus_state state; // current state of bus + ata_bus_state state; // current state of bus + struct ata_request * qreqActive; + struct ata_request * qreqFree; + + benaphore status_report_ben; // to lock when you report XPT about bus state // i.e. during requeue, resubmit or finished @@ -178,14 +173,11 @@ ide_bus_timer_info timer; // timeout scsi_dpc_cookie irq_dpc; - ide_synced_pc *synced_pc_list; ide_device_info *active_device; ide_device_info *devices[2]; ide_device_info *first_device; - ide_synced_pc disconnect_syncinfo; // used to handle lost controller - uchar path_id; device_node_handle node; // our pnp node @@ -213,68 +205,7 @@ restore_interrupts( prev_irq_state ); \ } -// SIM interface -#define IDE_SIM_MODULE_NAME "bus_managers/ide/sim/v1" - -enum { - ev_ide_send_command = 1, - ev_ide_device_start_service, - ev_ide_device_start_service2, - ev_ide_dpc_service, - ev_ide_dpc_continue, - ev_ide_irq_handle, - ev_ide_cancel_irq_timeout, - ev_ide_start_waiting, - ev_ide_timeout_dpc, - ev_ide_timeout, - ev_ide_reset_bus, - ev_ide_reset_device, - - ev_ide_scsi_io, - ev_ide_scsi_io_exec, - ev_ide_scsi_io_invalid_device, - ev_ide_scsi_io_bus_busy, - ev_ide_scsi_io_device_busy, - ev_ide_scsi_io_disconnected, - ev_ide_finish_request, - ev_ide_finish_norelease, - - ev_ide_scan_device_int, - ev_ide_scan_device_int_cant_send, - ev_ide_scan_device_int_keeps_busy, - ev_ide_scan_device_int_found -}; - - - -// get selected device -static inline -ide_device_info *get_current_device(ide_bus_info *bus) -{ - ide_task_file tf; - - bus->controller->read_command_block_regs(bus->channel_cookie, &tf, - ide_mask_device_head); [... truncated: 1365 lines follow ...] From mmlr at mail.berlios.de Wed Jan 9 23:00:51 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Wed, 9 Jan 2008 23:00:51 +0100 Subject: [Haiku-commits] r23332 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200801092200.m09M0p3C026284@sheep.berlios.de> Author: mmlr Date: 2008-01-09 23:00:51 +0100 (Wed, 09 Jan 2008) New Revision: 23332 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23332&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c Log: Clean out some of the spurious whitespace. Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-09 21:58:23 UTC (rev 23331) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-09 22:00:51 UTC (rev 23332) @@ -64,18 +64,18 @@ 0x50, // B 0x4e, // C 0x3e, // D - 0x29, // E - 0x3f, // F - 0x40, // G - 0x41, // H - 0x2e, // I + 0x29, // E + 0x3f, // F + 0x40, // G + 0x41, // H + 0x2e, // I 0x42, // J - 0x43, // K - 0x44, // L + 0x43, // K + 0x44, // L 0x52, // M - 0x51, // N - 0x2f, // O - 0x30, // P + 0x51, // N + 0x2f, // O + 0x30, // P 0x27, // Q 0x2a, // R 0x3d, // S @@ -85,12 +85,12 @@ 0x28, // W 0x4d, // X 0x2c, // Y - 0x4c, // Z - 0x12, // 1 + 0x4c, // Z + 0x12, // 1 0x13, // 2 0x14, // 3 0x15, // 4 - 0x16, // 5 + 0x16, // 5 0x17, // 6 0x18, // 7 0x19, // 8 @@ -105,8 +105,8 @@ 0x1d, // = 0x31, // [ 0x32, // ] - 0x00, // unmapped - 0x33, // \ + 0x00, // unmapped + 0x33, // \ 0x45, // ; 0x46, // ' 0x11, // ` @@ -128,7 +128,7 @@ 0x0d, // F12 0x0e, // PrintScreen KEY_Scroll, // Scroll Lock - KEY_Pause, // Pause (0x7f with Ctrl) + KEY_Pause, // Pause (0x7f with Ctrl) 0x1f, // Insert 0x20, // Home 0x21, // Page up @@ -146,7 +146,7 @@ 0x3a, // Pad + 0x5b, // Pad Enter 0x58, // Pad 1 - 0x59, // Pad 2 + 0x59, // Pad 2 0x5a, // Pad 3 0x48, // Pad 4 0x49, // Pad 5 @@ -156,7 +156,7 @@ 0x39, // Pad 9 0x64, // Pad 0 0x65, // Pad . - 0x69, // < + 0x69, // < KEY_Menu, // Menu KEY_Power, // Power KEY_NumEqual, // Pad = @@ -172,30 +172,30 @@ 0x00, // F22 unmapped 0x00, // F23 unmapped 0x00, // F24 unmapped - 0x00, // Execute unmapped - 0x00, // Help unmapped - 0x00, // Menu unmapped - 0x00, // Select unmapped - 0x00, // Stop unmapped - 0x00, // Again unmapped - 0x00, // Undo unmapped - 0x00, // Cut unmapped - 0x00, // Copy unmapped - 0x00, // Paste unmapped - 0x00, // Find unmapped - 0x00, // Mute unmapped - 0x00, // Volume up unmapped - 0x00, // Volume down unmapped - 0x00, // CapsLock unmapped - 0x00, // NumLock unmapped - 0x00, // Scroll lock unmapped - 0x70, // Keypad . on Brazilian ABNT2 - 0x00, // = sign - 0x6b, // Ro (\\ key, japanese) - 0x6e, // Katakana/Hiragana, second key right to spacebar, japanese - 0x6a, // Yen (macron key, japanese) - 0x6d, // Henkan, first key right to spacebar, japanese - 0x6c, // Muhenkan, key left to spacebar, japanese + 0x00, // Execute unmapped + 0x00, // Help unmapped + 0x00, // Menu unmapped + 0x00, // Select unmapped + 0x00, // Stop unmapped + 0x00, // Again unmapped + 0x00, // Undo unmapped + 0x00, // Cut unmapped + 0x00, // Copy unmapped + 0x00, // Paste unmapped + 0x00, // Find unmapped + 0x00, // Mute unmapped + 0x00, // Volume up unmapped + 0x00, // Volume down unmapped + 0x00, // CapsLock unmapped + 0x00, // NumLock unmapped + 0x00, // Scroll lock unmapped + 0x70, // Keypad . on Brazilian ABNT2 + 0x00, // = sign + 0x6b, // Ro (\\ key, japanese) + 0x6e, // Katakana/Hiragana, second key right to spacebar, japanese + 0x6a, // Yen (macron key, japanese) + 0x6d, // Henkan, first key right to spacebar, japanese + 0x6c, // Muhenkan, key left to spacebar, japanese 0x00, // unmapped 0x00, // unmapped 0x00, // unmapped @@ -291,17 +291,17 @@ sem_id sem; char area_name[32]; const char *base_name; - + assert (usb != NULL && dev != NULL); - if (isKeyboard) { + if (isKeyboard) { number = sKeyboardDeviceNumber++; base_name = sKeyboardBaseName; } else { number = sMouseDeviceNumber++; base_name = sMouseBaseName; } - + device = malloc(sizeof(hid_device_info)); if (device == NULL) return NULL; @@ -487,23 +487,23 @@ uint8 leds = 0; int report_id = 0; if (data[0] == 1) - leds |= (1 << 0); + leds |= (1 << 0); if (data[1] == 1) - leds |= (1 << 1); + leds |= (1 << 1); if (data[2] == 1) leds |= (1 << 2); - - status = usb->send_request (device->dev, + + status = usb->send_request (device->dev, USB_REQTYPE_INTERFACE_OUT | USB_REQTYPE_CLASS, USB_REQUEST_HID_SET_REPORT, - 0x200 | report_id, device->ifno, actual, + 0x200 | report_id, device->ifno, actual, &leds, actual, &actual); - DPRINTF_INFO ((MY_ID "set_leds: leds=0x%02x, status=%d, len=%d\n", + DPRINTF_INFO ((MY_ID "set_leds: leds=0x%02x, status=%d, len=%d\n", leds, (int) status, (int)actual)); } -static int +static int sign_extend(int value, int size) { if (value & (1 << (size - 1))) @@ -523,9 +523,9 @@ memset(&info, 0, sizeof(info)); for (i = 0; i < device->num_insns; i++) { const report_insn *insn = &device->insns [i]; - int32 value = - (((report [insn->byte_idx + 1] << 8) | - report [insn->byte_idx]) >> insn->bit_pos) + int32 value = + (((report [insn->byte_idx + 1] << 8) | + report [insn->byte_idx]) >> insn->bit_pos) & ((1 << insn->num_bits) - 1); if (insn->usage_page == USAGE_PAGE_BUTTON) { @@ -574,7 +574,7 @@ /*! callback: got a report, issue next request */ -static void +static void usb_callback(void *cookie, status_t busStatus, void *data, size_t actualLength) { @@ -630,7 +630,7 @@ DPRINTF_INFO ((MY_ID "input report: %s\n", linbuf)); #endif device->timestamp = system_time(); - + if (device->is_keyboard) { interpret_kb_buffer(device); memcpy(device->last_buffer, device->buffer, device->total_report_size); @@ -690,7 +690,7 @@ protocol = intf->descr->interface_protocol; DPRINTF_INFO ((MY_ID "interface %d: class %d, subclass %d, protocol %d\n", ifno, class, subclass, protocol)); - if (class == USB_HID_DEVICE_CLASS + if (class == USB_HID_DEVICE_CLASS && subclass == USB_HID_INTERFACE_BOOT_SUBCLASS) break; } @@ -704,12 +704,12 @@ desc_len = sizeof (usb_hid_descriptor); hid_desc = malloc (desc_len); - status = usb->send_request(dev, + status = usb->send_request(dev, USB_REQTYPE_INTERFACE_IN | USB_REQTYPE_STANDARD, USB_REQUEST_GET_DESCRIPTOR, - USB_HID_DESCRIPTOR_HID << 8, ifno, desc_len, + USB_HID_DESCRIPTOR_HID << 8, ifno, desc_len, hid_desc, desc_len, &desc_len); - DPRINTF_INFO ((MY_ID "get_hid_desc: status=%d, len=%d\n", + DPRINTF_INFO ((MY_ID "get_hid_desc: status=%d, len=%d\n", (int) status, (int)desc_len)); if (status != B_OK) desc_len = 256; /* XXX */ @@ -726,9 +726,9 @@ status = usb->send_request(dev, USB_REQTYPE_INTERFACE_IN | USB_REQTYPE_STANDARD, USB_REQUEST_GET_DESCRIPTOR, - USB_HID_DESCRIPTOR_REPORT << 8, ifno, desc_len, + USB_HID_DESCRIPTOR_REPORT << 8, ifno, desc_len, rep_desc, desc_len, &desc_len); - DPRINTF_INFO((MY_ID "get_hid_rep_desc: status=%d, len=%d\n", + DPRINTF_INFO((MY_ID "get_hid_rep_desc: status=%d, len=%d\n", (int) status, (int)desc_len)); if (status != B_OK) { free(rep_desc); @@ -744,9 +744,9 @@ } /* Generic Desktop : Keyboard or Mouse */ - + if (memcmp(rep_desc, "\x05\x01\x09\x06", 4) != 0 && - memcmp(rep_desc, "\x05\x01\x09\x02", 4) != 0) { + memcmp(rep_desc, "\x05\x01\x09\x02", 4) != 0) { DPRINTF_INFO((MY_ID "not a keyboard or a mouse %08lx\n", *(uint32*)rep_desc)); free(rep_desc); return B_ERROR; @@ -790,7 +790,7 @@ return B_NO_MEMORY; } - parse_report_descriptor (items, num_items, device->insns, + parse_report_descriptor (items, num_items, device->insns, &device->num_insns, &device->total_report_size, &report_id); free(items); @@ -801,7 +801,7 @@ return B_NO_MEMORY; } - DPRINTF_INFO ((MY_ID "%d items, %d insns, %d bytes\n", + DPRINTF_INFO ((MY_ID "%d items, %d insns, %d bytes\n", (int)num_items, (int)device->num_insns, (int)device->total_report_size)); /* count axes, hats and buttons */ @@ -847,7 +847,7 @@ assert (cookie != NULL); DPRINTF_INFO((MY_ID "device_removed(%s)\n", device->name)); - + usb->cancel_queued_transfers (device->ept->handle); remove_device_info(device); @@ -864,7 +864,7 @@ } -static status_t +static status_t hid_device_open(const char *name, uint32 flags, driver_cookie **out_cookie) { @@ -893,7 +893,7 @@ } -static status_t +static status_t hid_device_read(driver_cookie *cookie, off_t position, void *buf, size_t *num_bytes) { @@ -901,7 +901,7 @@ } -static status_t +static status_t hid_device_write(driver_cookie *cookie, off_t position, const void *buf, size_t *num_bytes) { @@ -909,7 +909,7 @@ } -static status_t +static status_t hid_device_control(driver_cookie *cookie, uint32 op, void *arg, size_t len) { @@ -938,25 +938,25 @@ // call_back function } - err = acquire_sem_etc(device->sem_cb, 1, - B_CAN_INTERRUPT | B_RELATIVE_TIMEOUT, - device->repeat_timer.current_delay); - if (err == B_TIMED_OUT) { - // this case is for handling key repeats, it means - // no interrupt transfer has happened - write_key(device, device->repeat_timer.key, true); - // the next timeout is reduced to the repeat_rate - device->repeat_timer.current_delay = device->repeat_rate; - } else if (err == B_OK) { - // this case is for when an actual interrupt transfer - // happened, it is the only possible reason to be here + err = acquire_sem_etc(device->sem_cb, 1, + B_CAN_INTERRUPT | B_RELATIVE_TIMEOUT, + device->repeat_timer.current_delay); + if (err == B_TIMED_OUT) { + // this case is for handling key repeats, it means + // no interrupt transfer has happened + write_key(device, device->repeat_timer.key, true); + // the next timeout is reduced to the repeat_rate + device->repeat_timer.current_delay = device->repeat_rate; + } else if (err == B_OK) { + // this case is for when an actual interrupt transfer + // happened, it is the only possible reason to be here device->transfer_scheduled = false; err = handle_interrupt_transfer(device); if (err != B_OK) return err; - } else { + } else { return err; - } + } } // process what is in the ring_buffer, it could be written @@ -964,11 +964,11 @@ // we wrote the current repeat key ring_buffer_user_read(device->rbuf, arg, sizeof(raw_key_info)); return B_OK; - + case KB_SET_LEDS: set_leds(device, (uint8 *)arg); - break; - } + break; + } } else { switch (op) { case MS_READ: @@ -979,11 +979,11 @@ // NOTE: this thread is now blocking until // the semaphore will be released from the // call_back function - + err = acquire_sem_etc(device->sem_cb, 1, B_CAN_INTERRUPT, 0LL); - if (err != B_OK) + if (err != B_OK) return err; - + err = handle_interrupt_transfer(device); if (err != B_OK) return err; @@ -992,9 +992,9 @@ ring_buffer_user_read(device->rbuf, arg, sizeof(mouse_movement)); return B_OK; - case MS_NUM_EVENTS: - return (int32)(ring_buffer_readable(device->rbuf) - / sizeof(mouse_movement)); + case MS_NUM_EVENTS: + return (int32)(ring_buffer_readable(device->rbuf) + / sizeof(mouse_movement)); case MS_SET_CLICKSPEED: #ifdef __HAIKU__ @@ -1014,7 +1014,7 @@ } -static status_t +static status_t hid_device_close(driver_cookie *cookie) { hid_device_info *device; @@ -1044,7 +1044,7 @@ } -static status_t +static status_t hid_device_free(driver_cookie *cookie) { hid_device_info *device; @@ -1070,7 +1070,7 @@ // #pragma mark - driver API -status_t +status_t init_hardware(void) { DPRINTF_INFO((MY_ID "init_hardware() " __DATE__ " " __TIME__ "\n")); @@ -1078,7 +1078,7 @@ } -status_t +status_t init_driver(void) { DPRINTF_INFO((MY_ID "init_driver() " __DATE__ " " __TIME__ "\n")); @@ -1092,7 +1092,7 @@ return gDeviceListLock; } - usb->register_driver(kDriverName, sSupportedDevices, + usb->register_driver(kDriverName, sSupportedDevices, SUPPORTED_DEVICES, NULL); usb->install_notify(kDriverName, &sNotifyHooks); DPRINTF_INFO((MY_ID "init_driver() OK\n")); From mmlr at mail.berlios.de Wed Jan 9 23:05:26 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Wed, 9 Jan 2008 23:05:26 +0100 Subject: [Haiku-commits] r23333 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200801092205.m09M5Qal026692@sheep.berlios.de> Author: mmlr Date: 2008-01-09 23:05:26 +0100 (Wed, 09 Jan 2008) New Revision: 23333 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23333&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c Log: Fix multi-line single-line comment warning... Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-09 22:00:51 UTC (rev 23332) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-09 22:05:26 UTC (rev 23333) @@ -106,7 +106,7 @@ 0x31, // [ 0x32, // ] 0x00, // unmapped - 0x33, // \ + 0x33, // \ 0x45, // ; 0x46, // ' 0x11, // ` From axeld at mail.berlios.de Wed Jan 9 23:25:21 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Jan 2008 23:25:21 +0100 Subject: [Haiku-commits] r23334 - in haiku/trunk: headers/private/kernel src/system/kernel/vm Message-ID: <200801092225.m09MPLmh028425@sheep.berlios.de> Author: axeld Date: 2008-01-09 23:25:21 +0100 (Wed, 09 Jan 2008) New Revision: 23334 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23334&view=rev Modified: haiku/trunk/headers/private/kernel/vm_types.h haiku/trunk/src/system/kernel/vm/vm_cache.cpp haiku/trunk/src/system/kernel/vm/vm_page.cpp Log: * Fixed (or rather, worked around) a deadlock in the VM: when a file was resized but still had dirty pages to be written back, vm_cache_resize() (which is called with the inode lock being held) deadlocked with the page writer. * Now, I reintroduced busy_writing: it'll be set by everything that writes back pages (vm_page_write_modified(), and the page writer), and will be checked for in vm_cache_resize() - other functions are not affected for now, AFAICT. * vm_cache_resize() will clear that flag, and the writer will check it again after it wrote back the page (which will fail when it's outside the file bounds), and if it's cleared, it will get rid of the page (if the file has been resized again in the mean time, writing it will succeed then, and we'll keep the page around). Modified: haiku/trunk/headers/private/kernel/vm_types.h =================================================================== --- haiku/trunk/headers/private/kernel/vm_types.h 2008-01-09 22:05:26 UTC (rev 23333) +++ haiku/trunk/headers/private/kernel/vm_types.h 2008-01-09 22:25:21 UTC (rev 23334) @@ -100,6 +100,7 @@ uint8 is_cleared : 1; // is currently only used in vm_page_allocate_page_run() + uint8 busy_writing : 1; uint16 wired_count; int8 usage_count; Modified: haiku/trunk/src/system/kernel/vm/vm_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2008-01-09 22:05:26 UTC (rev 23333) +++ haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2008-01-09 22:25:21 UTC (rev 23334) @@ -500,15 +500,23 @@ if (page->cache_offset >= newPageCount) { if (page->state == PAGE_STATE_BUSY) { - // wait for page to become unbusy - ConditionVariableEntry entry; - entry.Add(page); - mutex_unlock(&cache->lock); - entry.Wait(); - mutex_lock(&cache->lock); + if (page->busy_writing) { + // We cannot wait for the page to become available + // as we might cause a deadlock this way + page->busy_writing = false; + // this will notify the writer to free the page + page = next; + } else { + // wait for page to become unbusy + ConditionVariableEntry entry; + entry.Add(page); + mutex_unlock(&cache->lock); + entry.Wait(); + mutex_lock(&cache->lock); - // restart from the start of the list - page = cache->page_list; + // restart from the start of the list + page = cache->page_list; + } continue; } Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-01-09 22:05:26 UTC (rev 23333) +++ haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-01-09 22:25:21 UTC (rev 23334) @@ -835,6 +835,9 @@ page, page->cache_offset, status); } #endif + if (status == B_OK && length == 0) + status = B_ERROR; + return status; } @@ -960,6 +963,7 @@ InterruptsSpinLocker locker(sPageLock); remove_page_from_queue(&sModifiedPageQueue, page); page->state = PAGE_STATE_BUSY; + page->busy_writing = true; busyConditions[numPages].Publish(page, "page"); @@ -992,12 +996,21 @@ // put it into the active queue InterruptsSpinLocker locker(sPageLock); move_page_to_active_or_inactive_queue(pages[i], true); + pages[i]->busy_writing = false; } else { // We don't have to put the PAGE_MODIFIED bit back, as it's // still in the modified pages list. - InterruptsSpinLocker locker(sPageLock); - pages[i]->state = PAGE_STATE_MODIFIED; - enqueue_page(&sModifiedPageQueue, pages[i]); + { + InterruptsSpinLocker locker(sPageLock); + pages[i]->state = PAGE_STATE_MODIFIED; + enqueue_page(&sModifiedPageQueue, pages[i]); + } + if (!pages[i]->busy_writing) { + // someone has cleared the busy_writing flag which tells + // us our page has gone invalid + vm_cache_remove_page(cache, pages[i]); + } else + pages[i]->busy_writing = false; } busyConditions[i].Unpublish(); @@ -1246,6 +1259,7 @@ } page->state = PAGE_STATE_BUSY; + page->busy_writing = true; ConditionVariable busyCondition; busyCondition.Publish(page, "page"); @@ -1272,14 +1286,25 @@ if (status == B_OK) { // put it into the active/inactive queue move_page_to_active_or_inactive_queue(page, dequeuedPage); + page->busy_writing = false; } else { // We don't have to put the PAGE_MODIFIED bit back, as it's still // in the modified pages list. if (dequeuedPage) { page->state = PAGE_STATE_MODIFIED; enqueue_page(&sModifiedPageQueue, page); - } else - set_page_state_nolock(page, PAGE_STATE_MODIFIED); + } + + if (!page->busy_writing) { + // someone has cleared the busy_writing flag which tells + // us our page has gone invalid + vm_cache_remove_page(cache, page); + } else { + if (!dequeuedPage) + set_page_state_nolock(page, PAGE_STATE_MODIFIED); + + page->busy_writing = false; + } } busyCondition.Unpublish(); @@ -1345,6 +1370,7 @@ new(&sPages[i].mappings) vm_page_mappings(); sPages[i].wired_count = 0; sPages[i].usage_count = 0; + sPages[i].busy_writing = false; sPages[i].cache = NULL; #ifdef DEBUG_PAGE_QUEUE sPages[i].queue = NULL; From mmu_man at mail.berlios.de Thu Jan 10 00:41:26 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 00:41:26 +0100 Subject: [Haiku-commits] r23335 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801092341.m09NfQpR022954@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 00:41:15 +0100 (Thu, 10 Jan 2008) New Revision: 23335 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23335&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S Log: Notes on prg file format. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-09 22:25:21 UTC (rev 23334) +++ haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-09 23:41:15 UTC (rev 23335) @@ -34,7 +34,13 @@ * Add to image: * dd conv=notrunc if=haiku/trunk/stage1 of=em-20-200.swapped.hd bs=1 count=30 * set bootable: - * echo -en '\x12\x34' | dd conv=notrunc seek=510 bs=1 count=2 of=em-20-200.swapped.hd + * XXX: that's wrong! echo -en '\x12\x34' | dd conv=notrunc seek=510 bs=1 count=2 of=em-20-200.swapped.hd + * + * .PRG file format: + * http://mail-index.netbsd.org/tech-userlevel/2007/04/02/0000.html + * http://pagesperso-orange.fr/patrice.mandin/en/howto-binutils.html + * http://www.wotsit.org/download.asp?f=atariexe&sc=252874182 + * */ #include "toscalls.h" From marcusoverhagen at mail.berlios.de Thu Jan 10 00:59:01 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Thu, 10 Jan 2008 00:59:01 +0100 Subject: [Haiku-commits] r23336 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801092359.m09Nx15w011392@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-10 00:59:00 +0100 (Thu, 10 Jan 2008) New Revision: 23336 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23336&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c Log: started reimplementing pio command completition... Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 23:41:15 UTC (rev 23335) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-09 23:59:00 UTC (rev 23336) @@ -125,7 +125,18 @@ } +// busy wait for device beeing ready, +// using the timeout set by the previous ata_send_command status_t +ata_pio_wait_drdy(ide_device_info *device) +{ + ASSERT(bus->state == ata_state_pio); + return ata_wait(bus, ide_status_drdy, ide_status_bsy, false, device->bus->pio_timeout); +} + + + +status_t ata_send_command(ide_device_info *device, ata_request *request, bool need_drdy, uint32 timeout, ata_bus_state new_state) { @@ -189,6 +200,7 @@ ASSERT(bus->state == ata_state_busy); bus->state = new_state; + bus->pio_timeout = timeout * 1000; IDE_UNLOCK(bus); @@ -205,7 +217,12 @@ return B_ERROR; } +status_t +ata_finish_command(ide_device_info *device) +{ +} + status_t ata_reset_bus(ide_bus_info *bus, bool *_devicePresent0, uint32 *_sigDev0, bool *_devicePresent1, uint32 *_sigDev1) { @@ -275,7 +292,7 @@ dprintf("ATA: reset_bus: timeout\n"); goto error; } - +timeout if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high | ide_mask_error) != B_OK) goto error; @@ -594,7 +611,7 @@ */ void -ata_send_rw(ide_device_info *device, ata_request *request, +ata_exec_read_write(ide_device_info *device, ata_request *request, uint64 pos, size_t length, bool write) { ide_bus_info *bus = device->bus; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-09 23:41:15 UTC (rev 23335) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-09 23:59:00 UTC (rev 23336) @@ -62,16 +62,27 @@ // ide request typedef struct ata_request { - struct ide_device_info *device; - - scsi_ccb *ccb; // basic request - uint8 is_write : 1; // true for write request - uint8 uses_dma : 1; // true if using dma - uint8 packet_irq : 1; // true if waiting for command packet irq + struct ide_device_info * device; + scsi_ccb * ccb; // basic scsi request + uint8 is_write : 1; // true for write request + uint8 uses_dma : 1; // true if using dma + uint8 packet_irq : 1; // true if waiting for command packet irq } ata_request; +//void init_ata_request(ata_request *request, struct ide_device_info *device, scsi_ccb *ccb); +static inline void +init_ata_request(ata_request *request, struct ide_device_info *device, scsi_ccb *ccb) +{ + request->device = device; + request->ccb = ccb; + request->is_write = 0; + request->uses_dma = 0; + request->packet_irq = 0; +} + + typedef struct ide_device_info { struct ide_bus_info *bus; @@ -118,6 +129,7 @@ uint8 device_type; // atapi device type // pio from here on + bigtime_t pio_timeout; int left_sg_elem; // remaining sg elements const physical_entry *cur_sg_elem; // active sg element int cur_sg_ofs; // offset in active sg element @@ -160,8 +172,8 @@ ata_bus_state state; // current state of bus - struct ata_request * qreqActive; - struct ata_request * qreqFree; + struct ata_request * requestActive; + struct ata_request * requestFree; benaphore status_report_ben; // to lock when you report XPT about bus state @@ -218,12 +230,12 @@ status_t ata_reset_bus(ide_bus_info *bus, bool *_devicePresent0, uint32 *_sigDev0, bool *_devicePresent1, uint32 *_sigDev1); status_t ata_reset_device(ide_device_info *device, bool *_devicePresent); status_t ata_send_command(ide_device_info *device, ata_request *request, bool need_drdy, uint32 timeout, ata_bus_state new_state); +status_t ata_finish_command(ide_device_info *device); bool check_rw_error(ide_device_info *device, ata_request *request); bool check_output(ide_device_info *device, bool drdy_required, int error_mask, bool is_write); -void ata_send_rw(ide_device_info *device, ata_request *request, - uint64 pos, size_t length, bool write); +void ata_exec_read_write(ide_device_info *device, ata_request *request, uint64 pos, size_t length, bool write); void ata_dpc_DMA(ata_request *request); void ata_dpc_PIO(ata_request *request); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 23:41:15 UTC (rev 23335) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-09 23:59:00 UTC (rev 23336) @@ -46,8 +46,6 @@ sim_scsi_io(ide_bus_info *bus, scsi_ccb *ccb) { ide_device_info *device; - ata_request *request; - //ide_request_priv *priv; FLOW("sim_scsi_iobus %p, %d:%d\n", bus, ccb->target_id, ccb->target_lun); @@ -76,7 +74,7 @@ goto err_bus_busy; // bail out if device can't accept further requests - if (bus->qreqFree == NULL) + if (bus->requestFree == NULL) goto err_device_busy; bus->state = ata_state_busy; @@ -85,17 +83,15 @@ RELEASE_BEN(&bus->status_report_ben); // as we own the bus, noone can bother us - request = bus->qreqFree; - bus->qreqFree = NULL; - bus->qreqActive = request; + ASSERT(bus->requestActive == NULL); + bus->requestActive = bus->requestFree; + bus->requestFree = NULL; - request->device = device; - request->ccb = ccb; - request->uses_dma = false; + init_ata_request(bus->requestActive, device, ccb); FLOW("calling exec_io: %p, %d:%d\n", bus, ccb->target_id, ccb->target_lun); - device->exec_io(device, request); + device->exec_io(device, bus->requestActive); return; @@ -187,14 +183,12 @@ if (bus->disconnected) return; - // XXX fix me IDE_LOCK(bus); ASSERT(bus->state == ata_state_idle); bus->state = ata_state_busy; IDE_UNLOCK(bus); - for (i = 0; i < bus->max_devices; ++i) { if (bus->devices[i]) destroy_device(bus->devices[i]); @@ -224,7 +218,6 @@ } } - // XXX fix me IDE_LOCK(bus); ASSERT(bus->state == ata_state_busy); @@ -346,8 +339,8 @@ ccb = request->ccb; - bus->qreqFree = bus->qreqActive; - bus->qreqActive = NULL; + bus->requestFree = bus->requestActive; + bus->requestActive = NULL; // release bus, handling service requests; // TBD: @@ -446,8 +439,8 @@ ide_device_info *device = request->device; ide_bus_info *bus = device->bus; - bus->qreqFree = bus->qreqActive; - bus->qreqActive = 0; + bus->requestFree = bus->requestActive; + bus->requestActive = 0; ACQUIRE_BEN(&bus->status_report_ben); @@ -549,10 +542,10 @@ bus->first_device = NULL; - bus->qreqActive = NULL; - bus->qreqFree = (ata_request *)malloc(sizeof(ata_request)); + bus->requestActive = NULL; + bus->requestFree = (ata_request *)malloc(sizeof(ata_request)); - memset(bus->qreqFree, 0, sizeof(ata_request)); + memset(bus->requestFree, 0, sizeof(ata_request)); // read restrictions of controller @@ -612,9 +605,9 @@ DELETE_BEN(&bus->status_report_ben); scsi->free_dpc(bus->irq_dpc); - if (bus->qreqActive) + if (bus->requestActive) dprintf("ide_sim_uninit_bus: Warning request still active\n"); - free(bus->qreqFree); + free(bus->requestFree); free(bus); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-09 23:41:15 UTC (rev 23335) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-09 23:59:00 UTC (rev 23336) @@ -18,6 +18,8 @@ #include +#define TRACE dprintf +#define FLOW dprintf /** emulate MODE SENSE 10 command */ @@ -202,36 +204,38 @@ /*! Emulate TEST UNIT READY */ -static bool +static status_t ata_test_unit_ready(ide_device_info *device, ata_request *request) { -#if 0 - SHOW_FLOW0(3, ""); + TRACE("ata_test_unit_ready\n"); if (!device->infoblock.RMSN_supported || device->infoblock._127_RMSN_support != 1) - return true; + return B_OK; // ask device about status device->tf_param_mask = 0; device->tf.write.command = IDE_CMD_GET_MEDIA_STATUS; - if (!send_command(device, request, true, 15, ide_state_sync_waiting)) - return false; + if (ata_send_command(device, request, true, 15, ide_state_pio) != B_OK) + return B_ERROR; + if (ata_pio_wait_drdy(device) != B_OK) + return B_ERROR; + + // bits ide_error_mcr | ide_error_mc | ide_error_wp are also valid // but not requested by TUR; ide_error_wp can safely be ignored, but - // we don't want to loose media change (ccb) reports + // we don't want to loose media change (request) reports if (!check_output(device, true, ide_error_nm | ide_error_abrt | ide_error_mcr | ide_error_mc, false)) { - // SCSI spec is unclear here: we shouldn't report "media change (ccb)" + // SCSI spec is unclear here: we shouldn't report "media change (request)" // but what to do if there is one? anyway - we report them ; } -#endif - return true; + return B_OK; } @@ -389,10 +393,11 @@ { scsi_ccb *ccb = request->ccb; - SHOW_FLOW(3, "command=%x", ccb->cdb[0]); + FLOW("ata_exec_io: scsi command 0x%02x\n", ccb->cdb[0]); // ATA devices have one LUN only if (ccb->target_lun != 0) { + FLOW("ata_exec_io: wrong target lun\n"); ccb->subsys_status = SCSI_SEL_TIMEOUT; finish_request(request, false); return; @@ -498,9 +503,9 @@ | (uint32)cmd->low_lba; length = cmd->length != 0 ? cmd->length : 256; - SHOW_FLOW(3, "READ6/WRITE6 pos=%lx, length=%lx", pos, length); + FLOW("READ6/WRITE6 pos=%lx, length=%lx\n", pos, length); - ata_send_rw(device, request, pos, length, cmd->opcode == SCSI_OP_WRITE_6); + ata_exec_read_write(device, request, pos, length, cmd->opcode == SCSI_OP_WRITE_6); return; } @@ -514,8 +519,10 @@ pos = B_BENDIAN_TO_HOST_INT32(cmd->lba); length = B_BENDIAN_TO_HOST_INT16(cmd->length); + FLOW("READ10/WRITE10 pos=%lx, length=%lx\n", pos, length); + if (length != 0) { - ata_send_rw(device, request, pos, length, cmd->opcode == SCSI_OP_WRITE_10); + ata_exec_read_write(device, request, pos, length, cmd->opcode == SCSI_OP_WRITE_10); } else { // we cannot transfer zero blocks (apart from LBA48) finish_request(request, false); @@ -524,6 +531,7 @@ } default: + FLOW("command not implemented\n"); set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); } From mmlr at mail.berlios.de Thu Jan 10 12:45:21 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 10 Jan 2008 12:45:21 +0100 Subject: [Haiku-commits] r23337 - haiku/trunk/src/add-ons/kernel/drivers/bus/usb Message-ID: <200801101145.m0ABjLO1023849@sheep.berlios.de> Author: mmlr Date: 2008-01-10 12:45:20 +0100 (Thu, 10 Jan 2008) New Revision: 23337 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23337&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp Log: Reset the freed device name list so it is not freed a second time on republish. Also check the allocation of the new name list. Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-01-09 23:59:00 UTC (rev 23336) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-01-10 11:45:20 UTC (rev 23337) @@ -611,6 +611,7 @@ for (int32 i = 1; gDeviceNames[i]; i++) free(gDeviceNames[i]); free(gDeviceNames); + gDeviceNames = NULL; } benaphore_destroy(&gDeviceListLock); @@ -626,10 +627,14 @@ for (int32 i = 1; gDeviceNames[i]; i++) free(gDeviceNames[i]); free(gDeviceNames); + gDeviceNames = NULL; } int32 index = 0; gDeviceNames = (char **)malloc(sizeof(char *) * (gDeviceCount + 2)); + if (!gDeviceNames) + return NULL; + gDeviceNames[index++] = DEVICE_NAME; benaphore_lock(&gDeviceListLock); From stippi at mail.berlios.de Thu Jan 10 14:46:36 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 10 Jan 2008 14:46:36 +0100 Subject: [Haiku-commits] r23338 - haiku/trunk/src/kits/media Message-ID: <200801101346.m0ADkatC031105@sheep.berlios.de> Author: stippi Date: 2008-01-10 14:46:35 +0100 (Thu, 10 Jan 2008) New Revision: 23338 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23338&view=rev Modified: haiku/trunk/src/kits/media/DefaultMediaTheme.cpp Log: patch by aldeck: * fixes the content inside the tabview in the Media preflet spanning over the wrong area (wrong insets) Modified: haiku/trunk/src/kits/media/DefaultMediaTheme.cpp =================================================================== --- haiku/trunk/src/kits/media/DefaultMediaTheme.cpp 2008-01-10 11:45:20 UTC (rev 23337) +++ haiku/trunk/src/kits/media/DefaultMediaTheme.cpp 2008-01-10 13:46:35 UTC (rev 23338) @@ -389,8 +389,9 @@ TabView::FrameResized(float width, float height) { BRect rect = Bounds(); - rect.InsetBySelf(1, 1); rect.top += TabHeight(); + rect.InsetBy(3.0f, 3.0f); + //ContainerView is inseted by 3.0 in BTabView::_InitObject() ContainerView()->ResizeTo(rect.Width(), rect.Height()); } From jackburton at mail.berlios.de Thu Jan 10 15:06:12 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 10 Jan 2008 15:06:12 +0100 Subject: [Haiku-commits] r23339 - haiku/trunk/src/kits/interface Message-ID: <200801101406.m0AE6C73000280@sheep.berlios.de> Author: jackburton Date: 2008-01-10 15:06:11 +0100 (Thu, 10 Jan 2008) New Revision: 23339 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23339&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp Log: Merged (parts of, for now) patches from Rene Gollent and Christof Lutteroth, which improve menu keyboard navigation. Sorry for the delay, I had these patches sitting on my hard drive for a while. At least now you can open a menu with ALT + ESC, navigate it with the arrow keys, and invoke an item. Various issues still exist, including: menubars don't get the keydown messages, and if you keep the mouse over the menu while navigating with the keyboard, nothing will happen. Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-10 13:46:35 UTC (rev 23338) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-10 14:06:11 UTC (rev 23339) @@ -1,10 +1,11 @@ /* - * Copyright 2001-2007, Haiku, Inc. + * Copyright 2001-2008, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: * Marc Flerackers (mflerackers at androme.be) - * Stefano Ceccherini (burton666 at libero.it) + * Stefano Ceccherini (stefano.ceccherini at gmail.com) + * Rene Gollent (anevilyak at gmail.com) */ #include @@ -19,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -831,11 +833,36 @@ case B_LEFT_ARROW: if (fLayout == B_ITEMS_IN_ROW) _SelectNextItem(fSelected, false); + else { + // this case has to be handled a bit specially. + BMenuItem *item = Superitem(); + if (item) { + if (dynamic_cast(Supermenu())) { + // if we're at the top menu below the menu bar, pass the keypress to + // the menu bar so we can move to another top level menu + BMessenger msgr(Supermenu()); + msgr.SendMessage(Window()->CurrentMessage()); + } else + Supermenu()->_SelectItem(item, false, false); + } + } break; case B_RIGHT_ARROW: if (fLayout == B_ITEMS_IN_ROW) _SelectNextItem(fSelected, true); + else { + if (fSelected && fSelected->Submenu()) { + _SelectItem(fSelected, true, true); + } else if (dynamic_cast(Supermenu())) { + // if we have no submenu and we're an + // item in the top menu below the menubar, + // pass the keypress to the menubar + // so you can use the keypress to switch menus. + BMessenger msgr(Supermenu()); + msgr.SendMessage(Window()->CurrentMessage()); + } + } break; case B_ENTER: @@ -2121,11 +2148,14 @@ bool BMenu::_SelectNextItem(BMenuItem *item, bool forward) { + if (CountItems() == 0) // cannot select next item in an empty menu + return false; + BMenuItem *nextItem = _NextItem(item, forward); if (nextItem == NULL) return false; - _SelectItem(nextItem); + _SelectItem(nextItem, false); return true; } @@ -2133,21 +2163,34 @@ BMenuItem * BMenu::_NextItem(BMenuItem *item, bool forward) const { - if (item == NULL) { + /*if (item == NULL) { if (forward) return ItemAt(CountItems() - 1); return ItemAt(0); } +*/ + // go to next item, and skip over disabled items such as separators + int32 index = fItems.IndexOf(item); + if (index < 0) + index = 0; - int32 index = fItems.IndexOf(item); - if (forward) - index++; - else - index--; + int32 startIndex = index; + do { + if (forward) + index++; + else + index--; + + // cycle through menu items + if (index < 0) + index = CountItems() - 1; + else if(index >= fItems.CountItems()) + index = 0; + } while (!ItemAt(index)->IsEnabled() && index != startIndex); - if (index < 0 || index >= fItems.CountItems()) - return NULL; + if (index == startIndex) // we are back where we started and no item was enabled + return false; return ItemAt(index); } @@ -2343,6 +2386,7 @@ fChosenItem = NULL; fState = MENU_STATE_CLOSED; + _Hide(); } From mmu_man at mail.berlios.de Thu Jan 10 15:49:15 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 15:49:15 +0100 Subject: [Haiku-commits] r23340 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801101449.m0AEnFWY004858@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 15:49:13 +0100 (Thu, 10 Jan 2008) New Revision: 23340 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23340&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S Log: Some more test code... it runs now as .PRG! Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-10 14:06:11 UTC (rev 23339) +++ haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-10 14:49:13 UTC (rev 23340) @@ -40,6 +40,9 @@ * http://mail-index.netbsd.org/tech-userlevel/2007/04/02/0000.html * http://pagesperso-orange.fr/patrice.mandin/en/howto-binutils.html * http://www.wotsit.org/download.asp?f=atariexe&sc=252874182 + * + * generated.m68k/cross-tools/bin/m68k-unknown-haiku-gcc -nostdlib -fpic -Wa,--pcrel -c -o stage1.o src/system/boot/platform/atari_m68k/stage1.S + * generated.m68k/cross-tools/bin/m68k-unknown-haiku-ld -o stage1.prg stage1.o -T src/system/boot/platform/atari_m68k/prg.ld * */ @@ -70,7 +73,24 @@ #define S_IFDIR 00000040000o + //Pterm0 + //move.w #1,%d0 + //trap #1 + //rts + + lea.l str,%a0 +.loopt: + move.b (%a0)+,%d0 + beq .strout + bsr putc + bra .loopt +.strout: + //Pterm0 + move.w #1,%d0 + trap #1 + rts + .loop: move #'.',%d0 bsr putc @@ -79,10 +99,14 @@ /* prints the char in d0.b to the console */ putc: + movem.l %a0,-(%sp) move.w %d0,-(%sp) move.w #DEV_CON,-(%sp) // DEV_CON move.w #3,-(%sp) // Bconout trap #13 add.l #6,%sp + movem.l (%sp)+,%a0 rts - +str: + .ascii "Haiku!" + .byte 0 From mmu_man at mail.berlios.de Thu Jan 10 15:50:08 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 15:50:08 +0100 Subject: [Haiku-commits] r23341 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801101450.m0AEo8GL005052@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 15:50:03 +0100 (Thu, 10 Jan 2008) New Revision: 23341 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23341&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/prg.ld Log: ild script to build a .prg (only works with PC REL code!) Added: haiku/trunk/src/system/boot/platform/atari_m68k/prg.ld =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/prg.ld 2008-01-10 14:49:13 UTC (rev 23340) +++ haiku/trunk/src/system/boot/platform/atari_m68k/prg.ld 2008-01-10 14:50:03 UTC (rev 23341) @@ -0,0 +1,60 @@ +/*OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")*/ +OUTPUT_FORMAT("binary", "binary", "binary") +OUTPUT_ARCH(m68k) + +ENTRY(__text_start) +SEARCH_DIR("libgcc"); +SECTIONS +{ + /*. = 0x80000000 + SIZEOF_HEADERS;*/ + /* fool the alignment of .text */ + /*. = 0x20 - 0x1c;*/ + + /* .PRG file header */ + .prgheader : { + /*SHORT(0x55aa)*/ + SHORT(0x601a) /* MAGIC */ + LONG(__data_start - __text_start) /* TEXT SIZE */ + LONG(__bss_start - __data_start) /* DATA SIZE */ + LONG(_end - __bss_start) /* BSS SIZE */ + LONG(0) /* SYMBOL TABLE SIZE */ + LONG(0x4841494b) /* (reserved) 'HAIK' */ + LONG(0x1) /* PRGFLAGS : PF_FASTLOAD */ + SHORT(0) /* ABSFLAG */ + } + + __text_start = .; + /* ".text ." should align to 0x1c but doesn't work as expected, cf top. */ + .text . : { + *(.text .gnu.linkonce.t.*) + *(.rel.text) *(.rel.gnu.linkonce.t*) + *(.rela.text) *(.rela.gnu.linkonce.t*) + *(.rodata) + *(.rel.rodata) *(.rel.gnu.linkonce.r*) + *(.rela.rodata) *(.rela.gnu.linkonce.r*) + } + /* writable data */ + /* NO! . = ALIGN(0x1000); */ + __data_start = .; + .data : { + *(.data .gnu.linkonce.d.*) + *(.rel.data) *(.rel.gnu.linkonce.d*) + *(.rela.data) *(.rela.gnu.linkonce.d*) + } + /* unintialized data (in same segment as writable data) */ + __bss_start = .; + .bss : { + *(.bss) + *(.rel.bss) + *(.rela.bss) + } + /* . = ALIGN(0x1000); */ + _end = . ; + + .prgtrailer : { + LONG(0) /* FIXUP OFFSET */ + LONG(0) + } + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame) } +} Property changes on: haiku/trunk/src/system/boot/platform/atari_m68k/prg.ld ___________________________________________________________________ Name: svn:executable + * From mmu_man at mail.berlios.de Thu Jan 10 15:54:22 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 15:54:22 +0100 Subject: [Haiku-commits] r23342 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801101454.m0AEsMT8005671@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 15:54:20 +0100 (Thu, 10 Jan 2008) New Revision: 23342 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23342&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/prg.ld Log: Note on PIC limitations Modified: haiku/trunk/src/system/boot/platform/atari_m68k/prg.ld =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/prg.ld 2008-01-10 14:50:03 UTC (rev 23341) +++ haiku/trunk/src/system/boot/platform/atari_m68k/prg.ld 2008-01-10 14:54:20 UTC (rev 23342) @@ -1,4 +1,8 @@ -/*OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")*/ +/* + * ld script to generate a TOS .PRG + * *ONLY* works for PIC (PCREL) code! + */ + OUTPUT_FORMAT("binary", "binary", "binary") OUTPUT_ARCH(m68k) From jackburton at mail.berlios.de Thu Jan 10 17:04:57 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 10 Jan 2008 17:04:57 +0100 Subject: [Haiku-commits] r23343 - haiku/trunk/src/kits/interface Message-ID: <200801101604.m0AG4vQN013957@sheep.berlios.de> Author: jackburton Date: 2008-01-10 17:04:57 +0100 (Thu, 10 Jan 2008) New Revision: 23343 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23343&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp haiku/trunk/src/kits/interface/Window.cpp Log: IsModal() now includes also the kMenuWindowLook. Fixes bug #1269. Please review. Added a compile time option to switch off the use of the cached menu windows. Looks like there is a problem with the focus system, if I keep the cached menu window around, it "steals" keyboard events from the main app window after the menu has been opened and closed once. Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-10 14:54:20 UTC (rev 23342) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-10 16:04:57 UTC (rev 23343) @@ -34,6 +34,7 @@ #include "utf8_functions.h" +#define USE_CACHED_MENUWINDOW 0 using std::nothrow; using BPrivate::BMenuWindow; @@ -1367,13 +1368,15 @@ window->DetachMenu(); // we don't want to be deleted when the window is removed +#if USE_CACHED_MENUWINDOW if (fSuper != NULL) window->Unlock(); - else { + else +#endif + window->Quit(); // it's our window, quit it - window->Quit(); - } + // Delete the menu window used by our submenus _DeleteMenuWindow(); } @@ -2022,12 +2025,13 @@ BMenuWindow * BMenu::_MenuWindow() { +#if USE_CACHED_MENUWINDOW if (fCachedMenuWindow == NULL) { char windowName[64]; snprintf(windowName, 64, "%s cached menu", Name()); fCachedMenuWindow = new (nothrow) BMenuWindow(windowName); } - +#endif return fCachedMenuWindow; } @@ -2385,6 +2389,7 @@ menuBar->_RestoreFocus(); fChosenItem = NULL; + fState = MENU_STATE_CLOSED; _Hide(); } Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2008-01-10 14:54:20 UTC (rev 23342) +++ haiku/trunk/src/kits/interface/Window.cpp 2008-01-10 16:04:57 UTC (rev 23343) @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -1912,7 +1913,8 @@ { return fFeel == B_MODAL_SUBSET_WINDOW_FEEL || fFeel == B_MODAL_APP_WINDOW_FEEL - || fFeel == B_MODAL_ALL_WINDOW_FEEL; + || fFeel == B_MODAL_ALL_WINDOW_FEEL + || fFeel == kMenuWindowFeel; } From marcusoverhagen at mail.berlios.de Thu Jan 10 17:09:24 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Thu, 10 Jan 2008 17:09:24 +0100 Subject: [Haiku-commits] r23344 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801101609.m0AG9OUw014290@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-10 17:09:24 +0100 (Thu, 10 Jan 2008) New Revision: 23344 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23344&view=rev Added: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.h Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile Log: New struct ata_request. Added ata_request as wrapper around scsi_ccb while they are executed in the ata stack. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile 2008-01-10 16:04:57 UTC (rev 23343) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/Jamfile 2008-01-10 16:09:24 UTC (rev 23344) @@ -6,6 +6,7 @@ KernelAddon ide : ata.c + ata_request.c atapi.c channels.c devices.c Added: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-10 16:04:57 UTC (rev 23343) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-10 16:09:24 UTC (rev 23344) @@ -0,0 +1,153 @@ + +#include "ata_request.h" +#include "ide_internal.h" +#include "scsi_cmds.h" +#include + +#define TRACE dprintf + +void +ata_request_init(ata_request *request, struct ide_device_info *device) +{ + memset(request, 0, sizeof(request)); + request->device = device; +} + + +/* Start the request, but don't clear sense to allow + * retrieving the previous sense data. + */ +void ata_request_start(ata_request **_request, struct ide_device_info *device, struct scsi_ccb *ccb) +{ + ata_request *request; + + IDE_LOCK(device->bus); + if (device->bus->state != ata_state_idle) { + request = NULL; + } else { + ASSERT(device->requestFree != NULL); + ASSERT(device->requestActive == NULL); + ASSERT(device->bus->active_device == NULL); + + device->bus->state = ata_state_busy; + device->bus->active_device = device; + + request = device->requestFree; + device->requestActive = request; + device->requestFree = NULL; + } + IDE_UNLOCK(device->bus); + + *_request = request; + + if (!request) + return; // bus was busy + + ASSERT(request->device == device); + + request->ccb = ccb; + request->is_write = 0; + request->uses_dma = 0; + request->packet_irq = 0; + + ASSERT(request->ccb->subsys_status == SCSI_REQ_INPROG); + + // pretend success + request->ccb->subsys_status = SCSI_REQ_CMP; + + // device_status always remains set to SCSI_STATUS_GOOD + // except when ata_request_set_checkcondition() is called. + request->ccb->device_status = SCSI_STATUS_GOOD; +} + + +void +ata_request_clear_sense(ata_request *request) +{ + request->senseKey = 0; + request->senseAsc = 0; + request->senseAscq = 0; +} + + +void +ata_request_set_status(ata_request *request, uint8 status) +{ + ASSERT(status != SCSI_REQ_CMP); + request->ccb->subsys_status = status; +} + + +void +ata_request_set_sense(ata_request *request, uint8 key, uint16 asc_acq) +{ + request->senseKey = key; + request->senseAsc = asc_acq >> 8; + request->senseAscq = asc_acq & 0xff; +} + + +void +ata_request_finish(ata_request *request, bool resubmit) +{ + scsi_ccb *ccb; + + TRACE("ata_request_finish: request %p, subsys_status 0x%02x, senseKey %02x\n", + request, request->ccb->subsys_status, request->senseKey); + + // when the request completed and has set sense + // data, report this to the scsci stack by setting + // CHECK CONDITION status + if (request->ccb->subsys_status == SCSI_REQ_CMP && request->senseKey != 0) { + + TRACE("ata_request_finish - setting check condition\n"); + + request->ccb->subsys_status = SCSI_REQ_CMP_ERR; + request->ccb->device_status = SCSI_STATUS_CHECK_CONDITION; + + // copy sense data if caller requested it + if ((request->ccb->flags & SCSI_DIS_AUTOSENSE) == 0) { + scsi_sense sense; + int sense_len; + + TRACE("ata_request_finish - copying autosense data\n"); + + // we cannot copy sense directly as sense buffer may be too small + scsi_set_sense(&sense, request); + + ASSERT(sizeof(*request->ccb->sense) == SCSI_MAX_SENSE_SIZE); + + sense_len = min(sizeof(*request->ccb->sense), sizeof(sense)); + + memcpy(request->ccb->sense, &sense, sense_len); + request->ccb->sense_resid = SCSI_MAX_SENSE_SIZE - sense_len; + request->ccb->subsys_status |= SCSI_AUTOSNS_VALID; + + // device sense gets reset once it's read + ata_request_clear_sense(request); + + ASSERT(request->ccb->subsys_status == SCSI_REQ_CMP_ERR); + ASSERT(request->ccb->device_status == SCSI_STATUS_CHECK_CONDITION); + } + } + + ccb = request->ccb; + + IDE_LOCK(request->device->bus); + ASSERT(request->device->bus->state == ata_state_busy); + ASSERT(request->device->bus->active_device == request->device); + ASSERT(request->device->requestActive == request); + ASSERT(request->device->requestFree == NULL); + request->device->bus->state = ata_state_idle; + request->device->bus->active_device = NULL; + request->device->requestActive = NULL; + request->device->requestFree = request; + IDE_UNLOCK(request->device->bus); + + ACQUIRE_BEN(&request->device->bus->status_report_ben); + if (resubmit) + scsi->resubmit(ccb); + else + scsi->finished(ccb, 1); + RELEASE_BEN(&request->device->bus->status_report_ben); +} Added: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.h 2008-01-10 16:04:57 UTC (rev 23343) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.h 2008-01-10 16:09:24 UTC (rev 23344) @@ -0,0 +1,33 @@ +/* + * Copyright 2008 Marcus Overhagen. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _ATA_REQUEST_H +#define _ATA_REQUEST_H + +#include + +typedef struct ata_request { + + struct ide_device_info * device; + struct scsi_ccb * ccb; // basic scsi request + uint8 is_write : 1; // true for write request + uint8 uses_dma : 1; // true if using dma + uint8 packet_irq : 1; // true if waiting for command packet irq + + uint8 senseKey; + uint8 senseAsc; + uint8 senseAscq; +} ata_request; + +struct scsi_ccb; +struct ide_device_info; + +void ata_request_init(ata_request *request, struct ide_device_info *device); +void ata_request_start(ata_request **_request, struct ide_device_info *device, struct scsi_ccb *ccb); +void ata_request_clear_sense(ata_request *request); +void ata_request_set_status(ata_request *request, uint8 status); +void ata_request_set_sense(ata_request *request, uint8 key, uint16 asc_acq); +void ata_request_finish(ata_request *request, bool resubmit); + +#endif From stefano.ceccherini at gmail.com Thu Jan 10 17:15:20 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 10 Jan 2008 17:15:20 +0100 Subject: [Haiku-commits] r23343 - haiku/trunk/src/kits/interface In-Reply-To: <200801101604.m0AG4vQN013957@sheep.berlios.de> References: <200801101604.m0AG4vQN013957@sheep.berlios.de> Message-ID: <894b9700801100815i2fde1f93uec6ed2fb7321d1fa@mail.gmail.com> 2008/1/10, jackburton at BerliOS : > Author: jackburton > Date: 2008-01-10 17:04:57 +0100 (Thu, 10 Jan 2008) > New Revision: 23343 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23343&view=rev > > Modified: > haiku/trunk/src/kits/interface/Menu.cpp > haiku/trunk/src/kits/interface/Window.cpp > Log: > IsModal() now includes also the kMenuWindowLook. Fixes bug #1269. Please > review. > Added a compile time option to switch off the use of the cached menu > windows. Looks like there is a problem with the focus system, if I keep > the cached menu window around, it "steals" keyboard events from the main > app window after the menu has been opened and closed once. This would mean there's some bug in the focus mechanism in the app_server, wouldn't it ? Axel, since you wrote that part, do you have any idea ? From marcusoverhagen at mail.berlios.de Thu Jan 10 17:34:32 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Thu, 10 Jan 2008 17:34:32 +0100 Subject: [Haiku-commits] r23345 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801101634.m0AGYW1R016356@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-10 17:34:32 +0100 (Thu, 10 Jan 2008) New Revision: 23345 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23345&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c Log: converted to use the new ata_request_* functions Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-10 16:09:24 UTC (rev 23344) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-10 16:34:32 UTC (rev 23345) @@ -21,10 +21,25 @@ #define TRACE dprintf #define FLOW dprintf -/** emulate MODE SENSE 10 command */ + +// set sense buffer according to device sense in ata_request +void +scsi_set_sense(scsi_sense *sense, const ata_request *request) +{ + memset(sense, 0, sizeof(*sense)); + + sense->error_code = SCSIS_CURR_ERROR; + sense->sense_key = request->senseKey; + sense->add_sense_length = sizeof(*sense) - 7; + sense->asc = request->senseAsc; + sense->ascq = request->senseAscq; + sense->sense_key_spec.raw.SKSV = 0; // no additional info +} + + static void -ata_mode_sense_10(ide_device_info *device, ata_request *request) +scsi_mode_sense_10(ide_device_info *device, ata_request *request) { scsi_ccb *ccb = request->ccb; scsi_cmd_mode_sense_10 *cmd = (scsi_cmd_mode_sense_10 *)ccb->cdb; @@ -51,7 +66,7 @@ if ((cmd->page_code != SCSI_MODEPAGE_CONTROL && cmd->page_code != SCSI_MODEPAGE_ALL) || (cmd->page_control != SCSI_MODE_SENSE_PC_CURRENT && cmd->page_control != SCSI_MODE_SENSE_PC_SAVED)) { - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_CDB_FIELD); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_CDB_FIELD); return; } @@ -109,7 +124,7 @@ scsi_modepage_control *page) { if (page->header.page_length != sizeof(*page) - sizeof(page->header)) { - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_PARAM_LIST_LENGTH_ERR); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_PARAM_LIST_LENGTH_ERR); return false; } @@ -121,7 +136,7 @@ /*! Emulate MODE SELECT 10 command */ static void -ata_mode_select_10(ide_device_info *device, ata_request *request) +scsi_mode_select_10(ide_device_info *device, ata_request *request) { scsi_ccb *ccb = request->ccb; scsi_cmd_mode_select_10 *cmd = (scsi_cmd_mode_select_10 *)ccb->cdb; @@ -132,7 +147,7 @@ char modepage_buffer[64]; // !!! enlarge this to support longer mode pages if (cmd->save_pages || cmd->pf != 1) { - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_CDB_FIELD); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_CDB_FIELD); return; } @@ -183,8 +198,7 @@ break; default: - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, - SCSIS_ASC_INV_PARAM_LIST_FIELD); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_PARAM_LIST_FIELD); return; } @@ -199,29 +213,31 @@ // if we arrive here, data length was incorrect err: - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_PARAM_LIST_LENGTH_ERR); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_PARAM_LIST_LENGTH_ERR); } -/*! Emulate TEST UNIT READY */ -static status_t -ata_test_unit_ready(ide_device_info *device, ata_request *request) +static void +scsi_test_unit_ready(ide_device_info *device, ata_request *request) { - TRACE("ata_test_unit_ready\n"); + TRACE("scsi_test_unit_ready\n"); - if (!device->infoblock.RMSN_supported + if (device->infoblock.RMSN_supported == 0 || device->infoblock._127_RMSN_support != 1) - return B_OK; + return; // ask device about status device->tf_param_mask = 0; device->tf.write.command = IDE_CMD_GET_MEDIA_STATUS; - if (ata_send_command(device, request, true, 15, ide_state_pio) != B_OK) - return B_ERROR; + if (ata_send_command(request, true, 15, ata_state_pio) != B_OK) { + return; + } + - if (ata_pio_wait_drdy(device) != B_OK) - return B_ERROR; + if (ata_pio_wait_drdy(device) != B_OK) { + return; + } // bits ide_error_mcr | ide_error_mc | ide_error_wp are also valid @@ -234,14 +250,12 @@ // but what to do if there is one? anyway - we report them ; } - - return B_OK; } /*! Flush internal device cache */ static bool -ata_flush_cache(ide_device_info *device, ata_request *request) +scsi_synchronize_cache(ide_device_info *device, ata_request *request) { #if 0 // we should also ask for FLUSH CACHE support, but everyone denies it @@ -270,7 +284,7 @@ load = true - load medium */ static bool -ata_load_eject(ide_device_info *device, ata_request *request, bool load) +scsi_load_eject(ide_device_info *device, ata_request *request, bool load) { #if 0 if (load) { @@ -293,18 +307,15 @@ } -/*! Emulate PREVENT ALLOW command */ -static bool -ata_prevent_allow(ide_device_info *device, bool prevent) +static void +scsi_prevent_allow(ide_device_info *device, ata_request *request, bool prevent) { - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_ILL_FUNCTION); - return false; + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_ILL_FUNCTION); } -/*! Emulate INQUIRY command */ static void -ata_inquiry(ide_device_info *device, ata_request *request) +scsi_inquiry(ide_device_info *device, ata_request *request) { scsi_ccb *ccb = request->ccb; scsi_res_inquiry data; @@ -313,7 +324,7 @@ uint32 transfer_size; if (cmd->evpd || cmd->page_code) { - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_CDB_FIELD); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_CDB_FIELD); return; } @@ -362,9 +373,9 @@ } -/*! Emulate READ CAPACITY command */ + static void -read_capacity(ide_device_info *device, ata_request *request) +scsi_read_capacity(ide_device_info *device, ata_request *request) { scsi_ccb *ccb = request->ccb; scsi_res_read_capacity data; @@ -372,7 +383,7 @@ uint32 lastBlock; if (cmd->pmi || cmd->lba) { - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_CDB_FIELD); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_CDB_FIELD); return; } @@ -387,6 +398,35 @@ } +static void +scsi_request_sense(ide_device_info *device, ata_request *request) +{ + scsi_ccb *ccb = request->ccb; + scsi_cmd_request_sense *cmd = (scsi_cmd_request_sense *)ccb->cdb; + scsi_sense sense; + uint32 transferSize; + + // Copy sense data from last request into data buffer of current request. + // The sense data of last request is still present in the current request, + // as is isn't been cleared by ata_exec_io for SCSI_OP_REQUEST_SENSE. + + if (request->senseKey != 0) + scsi_set_sense(&sense, request); + else + memset(&sense, 0, sizeof(sense)); + + copy_sg_data(ccb, 0, cmd->allocation_length, &sense, sizeof(sense), false); + + transferSize = min(sizeof(sense), cmd->allocation_length); + transferSize = min(transferSize, ccb->data_length); + + ccb->data_resid = ccb->data_length - transferSize; + + // reset sense information on read + ata_request_clear_sense(request); +} + + /*! Execute SCSI command */ void ata_exec_io(ide_device_info *device, ata_request *request) @@ -398,56 +438,58 @@ // ATA devices have one LUN only if (ccb->target_lun != 0) { FLOW("ata_exec_io: wrong target lun\n"); - ccb->subsys_status = SCSI_SEL_TIMEOUT; - finish_request(request, false); + ata_request_set_status(request, SCSI_SEL_TIMEOUT); + ata_request_finish(request, false /* no resubmit */); return; } - // starting a ccb means deleting sense, so don't do it if - // the command wants to read it - if (ccb->cdb[0] != SCSI_OP_REQUEST_SENSE) - start_request(device, request); + if (ccb->cdb[0] == SCSI_OP_REQUEST_SENSE) { + // No initial clear sense, as this request is used + // by the scsi stack to request the sense data of + // the previous command. + scsi_request_sense(device, request); + ata_request_finish(request, false /* no resubmit */); + return; + } + ata_request_clear_sense(request); + switch (ccb->cdb[0]) { case SCSI_OP_TEST_UNIT_READY: - ata_test_unit_ready(device, request); + scsi_test_unit_ready(device, request); break; - case SCSI_OP_REQUEST_SENSE: - ide_request_sense(device, request); - return; - case SCSI_OP_FORMAT: /* FORMAT UNIT */ // we could forward ccb to disk, but modern disks cannot // be formatted anyway, so we just refuse ccb // (exceptions are removable media devices, but to my knowledge // they don't have to be formatted as well) - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); break; case SCSI_OP_INQUIRY: - ata_inquiry(device, request); + scsi_inquiry(device, request); break; case SCSI_OP_MODE_SELECT_10: - ata_mode_select_10(device, request); + scsi_mode_select_10(device, request); break; case SCSI_OP_MODE_SENSE_10: - ata_mode_sense_10(device, request); + scsi_mode_sense_10(device, request); break; case SCSI_OP_MODE_SELECT_6: case SCSI_OP_MODE_SENSE_6: // we've told SCSI bus manager to emulates these commands - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); break; case SCSI_OP_RESERVE: case SCSI_OP_RELEASE: // though mandatory, this doesn't make much sense in a // single initiator environment; so what - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); break; case SCSI_OP_START_STOP: { @@ -460,34 +502,33 @@ if (!cmd->start) // we must always flush cache if start = 0 - ata_flush_cache(device, request); + scsi_synchronize_cache(device, request); if (cmd->load_eject) - ata_load_eject(device, request, cmd->start); - + scsi_load_eject(device, request, cmd->start); break; } - case SCSI_OP_PREVENT_ALLOW: { + case SCSI_OP_PREVENT_ALLOW: + { scsi_cmd_prevent_allow *cmd = (scsi_cmd_prevent_allow *)ccb->cdb; - - ata_prevent_allow(device, cmd->prevent); + scsi_prevent_allow(device, request, cmd->prevent); break; } case SCSI_OP_READ_CAPACITY: - read_capacity(device, request); + scsi_read_capacity(device, request); break; case SCSI_OP_VERIFY: // does anyone uses this function? // effectly, it does a read-and-compare, which IDE doesn't support - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); break; case SCSI_OP_SYNCHRONIZE_CACHE: // we ignore range and immediate bit, we always immediately flush everything - ata_flush_cache(device, request); + scsi_synchronize_cache(device, request); break; // sadly, there are two possible read/write operation codes; @@ -523,17 +564,16 @@ if (length != 0) { ata_exec_read_write(device, request, pos, length, cmd->opcode == SCSI_OP_WRITE_10); + return; } else { // we cannot transfer zero blocks (apart from LBA48) - finish_request(request, false); + ata_request_set_status(request, SCSI_REQ_CMP); } - return; } default: FLOW("command not implemented\n"); - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); } - - finish_checksense(request); + ata_request_finish(request, false /* no resubmit */); } From marcusoverhagen at mail.berlios.de Thu Jan 10 17:40:42 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Thu, 10 Jan 2008 17:40:42 +0100 Subject: [Haiku-commits] r23346 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801101640.m0AGeg07017478@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-10 17:40:42 +0100 (Thu, 10 Jan 2008) New Revision: 23346 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23346&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c Log: Removed finish_* functions and converted to new ata_request_* functions. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-10 16:34:32 UTC (rev 23345) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-10 16:40:42 UTC (rev 23346) @@ -39,13 +39,12 @@ scsi_for_sim_interface *scsi; -static void set_check_condition(ata_request *request); - static void sim_scsi_io(ide_bus_info *bus, scsi_ccb *ccb) { ide_device_info *device; + ata_request *request; FLOW("sim_scsi_iobus %p, %d:%d\n", bus, ccb->target_id, ccb->target_lun); @@ -66,62 +65,38 @@ if (ccb->target_lun > device->last_lun) goto err_inv_device; - // grab the bus - ACQUIRE_BEN(&bus->status_report_ben); - IDE_LOCK(bus); + ata_request_start(&request, device, ccb); - if (bus->state != ata_state_idle) - goto err_bus_busy; + if (request) { + FLOW("calling exec_io: %p, %d:%d\n", bus, ccb->target_id, ccb->target_lun); + device->exec_io(device, request); + return; + } - // bail out if device can't accept further requests - if (bus->requestFree == NULL) - goto err_device_busy; - - bus->state = ata_state_busy; - - IDE_UNLOCK(bus); + FLOW("Bus busy\n"); + ACQUIRE_BEN(&bus->status_report_ben); + scsi->requeue(ccb, true); RELEASE_BEN(&bus->status_report_ben); - - // as we own the bus, noone can bother us - ASSERT(bus->requestActive == NULL); - bus->requestActive = bus->requestFree; - bus->requestFree = NULL; - - init_ata_request(bus->requestActive, device, ccb); - - FLOW("calling exec_io: %p, %d:%d\n", bus, ccb->target_id, ccb->target_lun); - - device->exec_io(device, bus->requestActive); - return; + err_inv_device: - FLOW("Invalid device %d:%d\n", ccb->target_id, ccb->target_lun); + FLOW("Invalid device %d:%d\n", ccb->target_id, ccb->target_lun); ccb->subsys_status = SCSI_SEL_TIMEOUT; + ACQUIRE_BEN(&bus->status_report_ben); scsi->finished(ccb, 1); - return; - -err_bus_busy: - FLOW("Bus busy\n"); - - IDE_UNLOCK(bus); - scsi->requeue(ccb, true); RELEASE_BEN(&bus->status_report_ben); return; -err_device_busy: - FLOW("Device busy\n"); - IDE_UNLOCK(bus); - scsi->requeue(ccb, false); - RELEASE_BEN(&bus->status_report_ben); - return; - err_disconnected: + TRACE("No controller anymore\n"); ccb->subsys_status = SCSI_NO_HBA; + ACQUIRE_BEN(&bus->status_report_ben); scsi->finished(ccb, 1); + RELEASE_BEN(&bus->status_report_ben); return; } @@ -200,11 +175,10 @@ if (!devicePresent[i]) continue; - isAtapi = deviceSignature[i] == 0xeb140101; - dprintf("ATA: scan_bus: bus %p, creating device %d, signature is 0x%08lx\n", bus, i, deviceSignature[i]); + isAtapi = deviceSignature[i] == 0xeb140101; device = create_device(bus, i /* isDevice1 */); if (scan_device(device, isAtapi) != B_OK) { @@ -230,7 +204,7 @@ static uchar sim_rescan_bus(ide_bus_info *bus) { - TRACE("ATA: sim_rescan_bus\n"); + TRACE("ATA: sim_rescan_bus - not implemented\n"); return SCSI_REQ_CMP; } @@ -264,7 +238,7 @@ if (bus->disconnected) return SCSI_NO_HBA; - + TRACE("ATA: sim_reset_bus - not implemented\n"); return SCSI_REQ_INVALID; } @@ -280,212 +254,6 @@ } -/** fill sense buffer according to device sense */ - -void -create_sense(ide_device_info *device, scsi_sense *sense) -{ - memset(sense, 0, sizeof(*sense)); - - sense->error_code = SCSIS_CURR_ERROR; - sense->sense_key = decode_sense_key(device->combined_sense); - sense->add_sense_length = sizeof(*sense) - 7; - sense->asc = decode_sense_asc(device->combined_sense); - sense->ascq = decode_sense_ascq(device->combined_sense); - sense->sense_key_spec.raw.SKSV = 0; // no additional info -} - - -/** finish command, updating sense of device and request, and release bus */ - -void -finish_checksense(ata_request *request) -{ - SHOW_FLOW(3, "%p, subsys_status=%d, sense=%x", - request->ccb, - request->ccb->subsys_status, - (int)request->device->new_combined_sense); - - request->ccb->subsys_status = request->device->subsys_status; - - if (request->ccb->subsys_status == SCSI_REQ_CMP) { - // device or emulation code completed command - request->device->combined_sense = request->device->new_combined_sense; - - // if emulation code detected error, set CHECK CONDITION - if (request->device->combined_sense) - set_check_condition(request); - } - - finish_request(request, false); -} - - -/** finish request and release bus - * resubmit - true, if request should be resubmitted by XPT - */ - -void -finish_request(ata_request *request, bool resubmit) -{ - ide_device_info *device = request->device; - ide_bus_info *bus = device->bus; - scsi_ccb *ccb; - - SHOW_FLOW0(3, ""); - - // save request first, as request can be reused as soon as - // access_finished is called! - ccb = request->ccb; - - - bus->requestFree = bus->requestActive; - bus->requestActive = NULL; - - // release bus, handling service requests; - // TBD: - // if we really handle a service request, the finished command - // is delayed unnecessarily, but if we tell the XPT about the finished - // command first, it will instantly try to pass us another - // request to handle, which we will refuse as the bus is still - // locked; this really has to be improved - access_finished(bus, device); - - ACQUIRE_BEN(&bus->status_report_ben); - - if (resubmit) - scsi->resubmit(ccb); - else - scsi->finished(ccb, 1); - - RELEASE_BEN(&bus->status_report_ben); -} - - -/** set CHECK CONDITION of device and perform auto-sense if requested. - * (don't move it before finish_request - we don't want to inline - * it as it's on the rarely used error path) - */ - -static void -set_check_condition(ata_request *request) -{ - scsi_ccb *ccb = request->ccb; - ide_device_info *device = request->device; - - SHOW_FLOW0(3, ""); - - ccb->subsys_status = SCSI_REQ_CMP_ERR; - ccb->device_status = SCSI_STATUS_CHECK_CONDITION; - - // copy sense only if caller requested it - if ((ccb->flags & SCSI_DIS_AUTOSENSE) == 0) { - scsi_sense sense; - int sense_len; - - SHOW_FLOW0(3, "autosense"); - - // we cannot copy sense directly as sense buffer may be too small - create_sense(device, &sense); - - sense_len = min(SCSI_MAX_SENSE_SIZE, sizeof(sense)); - - memcpy(ccb->sense, &sense, sense_len); - ccb->sense_resid = SCSI_MAX_SENSE_SIZE - sense_len; - ccb->subsys_status |= SCSI_AUTOSNS_VALID; - - // device sense gets reset once it's read - device->combined_sense = 0; - } -} - - -void -finish_retry(ata_request *request) -{ - request->device->combined_sense = 0; - finish_request(request, true); -} - - -/** finish request and abort pending requests of the device - * (to be called when the request failed and thus messed up the queue) - */ - -void -finish_reset_queue(ata_request *request) -{ - ide_bus_info *bus = request->device->bus; - - // don't remove block_bus!!! - // during finish_checksense, the bus is released, so - // the SCSI bus manager could send us further commands - scsi->block_bus(bus->scsi_cookie); - - finish_checksense(request); -// send_abort_queue(request->device); // XXX fix this - - scsi->unblock_bus(bus->scsi_cookie); -} - - -/** finish request, but don't release bus - * if resubmit is true, the request will be resubmitted - */ -/* -static void -finish_norelease(ata_request *request, bool resubmit) -{ - ide_device_info *device = request->device; - ide_bus_info *bus = device->bus; - - bus->requestFree = bus->requestActive; - bus->requestActive = 0; - - ACQUIRE_BEN(&bus->status_report_ben); - - if (resubmit) - scsi->resubmit(request->ccb); - else - scsi->finished(request->ccb, 1); - - RELEASE_BEN(&bus->status_report_ben); -} -*/ - -/** finish all queued requests but of the device; - * set resubmit, if requests are to be resubmitted by xpt - */ - -void -finish_all_requests(ide_device_info *device, ata_request *ignore, - int subsys_status, bool resubmit) -{ - - if (device == NULL) - return; - - // we only have to block the device, but for CD changers we - // have to block all LUNS of the device (and we neither know - // their device handle nor which exist at all), so block - // the entire bus instead (it won't take that long anyway) - scsi->block_bus(device->bus->scsi_cookie); - - // XXX fix this -/* - for (i = 0; i < device->queue_depth; ++i) { - ata_request *request = &device->qreq_array[i]; - - if (request->running && request != ignore) { - request->ccb->subsys_status = subsys_status; - finish_norelease(request, resubmit); - } - } -*/ - scsi->unblock_bus(device->bus->scsi_cookie); -} - - static status_t ide_sim_init_bus(device_node_handle node, void *user_cookie, void **cookie) { @@ -539,14 +307,6 @@ } } - bus->first_device = NULL; - - - bus->requestActive = NULL; - bus->requestFree = (ata_request *)malloc(sizeof(ata_request)); - - memset(bus->requestFree, 0, sizeof(ata_request)); - // read restrictions of controller if (pnp->get_attr_uint8(node, IDE_CONTROLLER_MAX_DEVICES_ITEM, @@ -605,10 +365,6 @@ DELETE_BEN(&bus->status_report_ben); scsi->free_dpc(bus->irq_dpc); - if (bus->requestActive) - dprintf("ide_sim_uninit_bus: Warning request still active\n"); - free(bus->requestFree); - free(bus); return B_OK; From mmu_man at mail.berlios.de Thu Jan 10 17:42:38 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 17:42:38 +0100 Subject: [Haiku-commits] r23347 - haiku/trunk/src/system/kernel/arch/m68k Message-ID: <200801101642.m0AGgcRC018372@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 17:42:38 +0100 (Thu, 10 Jan 2008) New Revision: 23347 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23347&view=rev Modified: haiku/trunk/src/system/kernel/arch/m68k/arch_elf.cpp Log: Should be enough for an m68k elf loader. hopefully I didn't screw up. Modified: haiku/trunk/src/system/kernel/arch/m68k/arch_elf.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/m68k/arch_elf.cpp 2008-01-10 16:40:42 UTC (rev 23346) +++ haiku/trunk/src/system/kernel/arch/m68k/arch_elf.cpp 2008-01-10 16:42:38 UTC (rev 23347) @@ -20,8 +20,60 @@ #include -#define CHATTY 0 +//#define TRACE_ARCH_ELF +#ifdef TRACE_ARCH_ELF +# define TRACE(x) dprintf x +# define CHATTY 1 +#else +# define TRACE(x) ; +# define CHATTY 0 +#endif + +#ifdef TRACE_ARCH_ELF +static const char *kRelocations[] = { + "R_68K_NONE", + "R_68K_32", /* Direct 32 bit */ + "R_68K_16", /* Direct 16 bit */ + "R_68K_8", /* Direct 8 bit */ + "R_68K_PC32", /* PC relative 32 bit */ + "R_68K_PC16", /* PC relative 16 bit */ + "R_68K_PC8", /* PC relative 8 bit */ + "R_68K_GOT32", /* 32 bit PC relative GOT entry */ + "R_68K_GOT16", /* 16 bit PC relative GOT entry */ + "R_68K_GOT8", /* 8 bit PC relative GOT entry */ + "R_68K_GOT32O", /* 32 bit GOT offset */ + "R_68K_GOT16O", /* 16 bit GOT offset */ + "R_68K_GOT8O", /* 8 bit GOT offset */ + "R_68K_PLT32", /* 32 bit PC relative PLT address */ + "R_68K_PLT16", /* 16 bit PC relative PLT address */ + "R_68K_PLT8", /* 8 bit PC relative PLT address */ + "R_68K_PLT32O", /* 32 bit PLT offset */ + "R_68K_PLT16O", /* 16 bit PLT offset */ + "R_68K_PLT8O", /* 8 bit PLT offset */ + "R_68K_COPY", /* Copy symbol at runtime */ + "R_68K_GLOB_DAT", /* Create GOT entry */ + "R_68K_JMP_SLOT", /* Create PLT entry */ + "R_68K_RELATIVE", /* Adjust by program base */ + /* These are GNU extensions to enable C++ vtable garbage collection. */ + "R_68K_GNU_VTINHERIT", + "R_68K_GNU_VTENTRY", +#if 0 + "R_386_NONE", + "R_386_32", /* add symbol value */ + "R_386_PC32", /* add PC relative symbol value */ + "R_386_GOT32", /* add PC relative GOT offset */ + "R_386_PLT32", /* add PC relative PLT offset */ + "R_386_COPY", /* copy data from shared object */ + "R_386_GLOB_DAT", /* set GOT entry to data address */ + "R_386_JMP_SLOT", /* set GOT entry to code address */ + "R_386_RELATIVE", /* add load address of shared object */ + "R_386_GOTOFF", /* add GOT relative symbol address */ + "R_386_GOTPC", /* add PC relative GOT table address */ +#endif +}; +#endif + #ifdef _BOOT_MODE status_t boot_arch_elf_relocate_rel(struct preloaded_image *image, @@ -38,84 +90,42 @@ static inline void -write_word32(addr_t P, Elf32_Word value) +write_32(addr_t P, Elf32_Word value) { *(Elf32_Word*)P = value; } static inline void -write_word30(addr_t P, Elf32_Word value) +write_16(addr_t P, Elf32_Word value) { - // bits 0:29 - *(Elf32_Word*)P = (*(Elf32_Word*)P & 0x3) | (value << 2); + // bits 16:29 + *(Elf32_Half*)P = (Elf32_Half)value; } static inline bool -write_low24_check(addr_t P, Elf32_Word value) +write_16_check(addr_t P, Elf32_Word value) { - // bits 6:29 - if ((value & 0x3f000000) && (~value & 0x3f800000)) + // bits 15:0 + if ((value & 0xffff0000) && (~value & 0xffff8000)) return false; - *(Elf32_Word*)P = (*(Elf32_Word*)P & 0xfc000003) - | ((value & 0x00ffffff) << 2); + *(Elf32_Half*)P = (Elf32_Half)value; return true; } static inline bool -write_low14_check(addr_t P, Elf32_Word value) +write_8_check(addr_t P, Elf32_Word value) { - // bits 16:29 - if ((value & 0x3fffc000) && (~value & 0x3fffe000)) + // bits 7:0 + if ((value & 0xffffff00) && (~value & 0xffffff80)) return false; - *(Elf32_Word*)P = (*(Elf32_Word*)P & 0xffff0003) - | ((value & 0x00003fff) << 2); - return true; -} - - -static inline void -write_half16(addr_t P, Elf32_Word value) -{ - // bits 16:29 *(Elf32_Half*)P = (Elf32_Half)value; -} - - -static inline bool -write_half16_check(addr_t P, Elf32_Word value) -{ - // bits 16:29 - if ((value & 0xffff0000) && (~value & 0xffff8000)) - return false; - *(Elf32_Half*)P = (Elf32_Half)value; return true; } -static inline Elf32_Word -lo(Elf32_Word value) -{ - return (value & 0xffff); -} - - -static inline Elf32_Word -hi(Elf32_Word value) -{ - return ((value >> 16) & 0xffff); -} - - -static inline Elf32_Word -ha(Elf32_Word value) -{ - return (((value >> 16) + (value & 0x8000 ? 1 : 0)) & 0xffff); -} - - #ifdef _BOOT_MODE status_t boot_arch_elf_relocate_rela(struct preloaded_image *image, @@ -159,34 +169,14 @@ ELF32_R_TYPE(rel[i].r_info), rel[i].r_offset, ELF32_R_SYM(rel[i].r_info), rel[i].r_addend); #endif switch (ELF32_R_TYPE(rel[i].r_info)) { - case R_PPC_SECTOFF: - case R_PPC_SECTOFF_LO: - case R_PPC_SECTOFF_HI: - case R_PPC_SECTOFF_HA: - dprintf("arch_elf_relocate_rela(): Getting section relative " - "symbol addresses not yet supported!\n"); - return B_ERROR; - - case R_PPC_ADDR32: - case R_PPC_ADDR24: - case R_PPC_ADDR16: - case R_PPC_ADDR16_LO: - case R_PPC_ADDR16_HI: - case R_PPC_ADDR16_HA: - case R_PPC_ADDR14: - case R_PPC_ADDR14_BRTAKEN: - case R_PPC_ADDR14_BRNTAKEN: - case R_PPC_REL24: - case R_PPC_REL14: - case R_PPC_REL14_BRTAKEN: - case R_PPC_REL14_BRNTAKEN: - case R_PPC_GLOB_DAT: - case R_PPC_UADDR32: - case R_PPC_UADDR16: - case R_PPC_REL32: - case R_PPC_SDAREL16: - case R_PPC_ADDR30: - case R_PPC_JMP_SLOT: + case R_68K_32: + case R_68K_16: + case R_68K_8: + case R_68K_PC32: + case R_68K_PC16: + case R_68K_PC8: + case R_68K_GLOB_DAT: + case R_68K_JMP_SLOT: sym = SYMBOL(image, ELF32_R_SYM(rel[i].r_info)); #ifdef _BOOT_MODE @@ -207,194 +197,132 @@ } switch (ELF32_R_TYPE(rel[i].r_info)) { - case R_PPC_NONE: + case R_68K_NONE: break; - case R_PPC_COPY: + case R_68K_COPY: // TODO: Implement! - dprintf("arch_elf_relocate_rela(): R_PPC_COPY not yet " + dprintf("arch_elf_relocate_rela(): R_68K_COPY not yet " "supported!\n"); return B_ERROR; - case R_PPC_ADDR32: - case R_PPC_GLOB_DAT: - case R_PPC_UADDR32: - write_word32(P, S + A); + case R_68K_32: + case R_68K_GLOB_DAT: + write_32(P, S + A); break; - case R_PPC_ADDR24: - if (write_low24_check(P, (S + A) >> 2)) + case R_68K_16: + if (write_16_check(P, S + A)) break; -dprintf("R_PPC_ADDR24 overflow\n"); +dprintf("R_68K_16 overflow\n"); return B_BAD_DATA; - case R_PPC_ADDR16: - case R_PPC_UADDR16: - if (write_half16_check(P, S + A)) + case R_68K_8: + if (write_8_check(P, S + A)) break; -dprintf("R_PPC_ADDR16 overflow\n"); +dprintf("R_68K_8 overflow\n"); return B_BAD_DATA; - case R_PPC_ADDR16_LO: - write_half16(P, lo(S + A)); + case R_68K_PC32: + write_32(P, (S + A - P)); break; - case R_PPC_ADDR16_HI: - write_half16(P, hi(S + A)); - break; - - case R_PPC_ADDR16_HA: - write_half16(P, ha(S + A)); - break; - - case R_PPC_ADDR14: - case R_PPC_ADDR14_BRTAKEN: - case R_PPC_ADDR14_BRNTAKEN: - if (write_low14_check(P, (S + A) >> 2)) + case R_68K_PC16: + if (write_16_check(P, (S + A - P))) break; -dprintf("R_PPC_ADDR14 overflow\n"); +dprintf("R_68K_PC16 overflow\n"); return B_BAD_DATA; - case R_PPC_REL24: - if (write_low24_check(P, (S + A - P) >> 2)) + case R_68K_PC8: + if (write_8(P, (S + A - P))) break; -dprintf("R_PPC_REL24 overflow: 0x%lx\n", (S + A - P) >> 2); +dprintf("R_68K_PC8 overflow\n"); return B_BAD_DATA; - case R_PPC_REL14: - case R_PPC_REL14_BRTAKEN: - case R_PPC_REL14_BRNTAKEN: - if (write_low14_check(P, (S + A - P) >> 2)) + case R_68K_GOT32: + REQUIRE_GOT; + write_32(P, (G + A - P)); + break; + + case R_68K_GOT16: + REQUIRE_GOT; + if (write_16_check(P, (G + A - P))) break; -dprintf("R_PPC_REL14 overflow\n"); +dprintf("R_68K_GOT16 overflow\n"); return B_BAD_DATA; - case R_PPC_GOT16: + case R_68K_GOT8: REQUIRE_GOT; - if (write_half16_check(P, G + A)) + if (write_8_check(P, (G + A - P))) break; -dprintf("R_PPC_GOT16 overflow\n"); +dprintf("R_68K_GOT8 overflow\n"); return B_BAD_DATA; - case R_PPC_GOT16_LO: + case R_68K_GOT32O: REQUIRE_GOT; - write_half16(P, lo(G + A)); + write_32(P, (G + A)); break; - case R_PPC_GOT16_HI: + case R_68K_GOT16O: REQUIRE_GOT; - write_half16(P, hi(G + A)); - break; + if (write_16_check(P, (G + A))) + break; +dprintf("R_68K_GOT16 overflow\n"); + return B_BAD_DATA; - case R_PPC_GOT16_HA: + case R_68K_GOT8O: REQUIRE_GOT; - write_half16(P, ha(G + A)); - break; + if (write_8_check(P, (G + A))) + break; +dprintf("R_68K_GOT8 overflow\n"); + return B_BAD_DATA; - case R_PPC_JMP_SLOT: - { - // If the relative offset is small enough, we fabricate a - // relative branch instruction ("b "). - addr_t jumpOffset = S - P; - if ((jumpOffset & 0xfc000000) != 0 - && (~jumpOffset & 0xfe000000) != 0) { - // Offset > 24 bit. - // TODO: Implement! - // See System V PPC ABI supplement, p. 5-6! - dprintf("arch_elf_relocate_rela(): R_PPC_JMP_SLOT: " - "Offsets > 24 bit currently not supported!\n"); -dprintf("jumpOffset: %p\n", (void*)jumpOffset); - return B_ERROR; - } else { - // Offset <= 24 bit - // 0:5 opcode (= 18), 6:29 address, 30 AA, 31 LK - // "b" instruction: opcode = 18, AA = 0, LK = 0 - // address: 24 high-order bits of 26 bit offset - *(uint32*)P = 0x48000000 | ((jumpOffset) & 0x03fffffc); - } + case R_68K_JMP_SLOT: + write_32(P, (G + A)); break; - } - case R_PPC_RELATIVE: - write_word32(P, B + A); + case R_68K_RELATIVE: + write_32(P, B + A); break; - case R_PPC_LOCAL24PC: -// TODO: Implement! -// low24* -// if (write_low24_check(P, ?) -// break; -// return B_BAD_DATA; - dprintf("arch_elf_relocate_rela(): R_PPC_LOCAL24PC not yet " - "supported!\n"); - return B_ERROR; - - case R_PPC_REL32: - write_word32(P, S + A - P); + case R_68K_PLT32: + REQUIRE_PLT; + write_32(P, (L + A - P)); break; - case R_PPC_PLTREL24: + case R_68K_PLT16: REQUIRE_PLT; - if (write_low24_check(P, (L + A - P) >> 2)) + if (write_16(P, (L + A - P))) break; -dprintf("R_PPC_PLTREL24 overflow\n"); +dprintf("R_68K_PLT16 overflow\n"); return B_BAD_DATA; - case R_PPC_PLT32: + case R_68K_PLT8: REQUIRE_PLT; - write_word32(P, L + A); - break; + if (write_8(P, (L + A - P))) + break; +dprintf("R_68K_PLT8 overflow\n"); + return B_BAD_DATA; - case R_PPC_PLTREL32: + case R_68K_PLT32O: REQUIRE_PLT; - write_word32(P, L + A - P); + write_32(P, (L + A)); break; - case R_PPC_PLT16_LO: + case R_68K_PLT16O: REQUIRE_PLT; - write_half16(P, lo(L + A)); - break; + if (write_16(P, (L + A))) + break; +dprintf("R_68K_PLT16O overflow\n"); + return B_BAD_DATA; - case R_PPC_PLT16_HI: + case R_68K_PLT8O: REQUIRE_PLT; - write_half16(P, hi(L + A)); - break; - - case R_PPC_PLT16_HA: - write_half16(P, ha(L + A)); - break; - - case R_PPC_SDAREL16: -// TODO: Implement! -// if (write_half16_check(P, S + A - _SDA_BASE_)) -// break; -// return B_BAD_DATA; - dprintf("arch_elf_relocate_rela(): R_PPC_SDAREL16 not yet " - "supported!\n"); - return B_ERROR; - - case R_PPC_SECTOFF: - if (write_half16_check(P, R + A)) + if (write_8(P, (L + A))) break; -dprintf("R_PPC_SECTOFF overflow\n"); +dprintf("R_68K_PLT8O overflow\n"); return B_BAD_DATA; - case R_PPC_SECTOFF_LO: - write_half16(P, lo(R + A)); - break; - - case R_PPC_SECTOFF_HI: - write_half16(P, hi(R + A)); - break; - - case R_PPC_SECTOFF_HA: - write_half16(P, ha(R + A)); - break; - - case R_PPC_ADDR30: - write_word30(P, (S + A - P) >> 2); - break; - default: dprintf("arch_elf_relocate_rela: unhandled relocation type %d\n", ELF32_R_TYPE(rel[i].r_info)); return B_ERROR; @@ -404,3 +332,5 @@ return B_NO_ERROR; } + + From mmu_man at mail.berlios.de Thu Jan 10 17:48:16 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 17:48:16 +0100 Subject: [Haiku-commits] r23348 - haiku/trunk/src/system/kernel/arch/m68k Message-ID: <200801101648.m0AGmG7j018938@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 17:48:16 +0100 (Thu, 10 Jan 2008) New Revision: 23348 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23348&view=rev Modified: haiku/trunk/src/system/kernel/arch/m68k/arch_elf.cpp Log: * Missing write_8() * Fixes Modified: haiku/trunk/src/system/kernel/arch/m68k/arch_elf.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/m68k/arch_elf.cpp 2008-01-10 16:42:38 UTC (rev 23347) +++ haiku/trunk/src/system/kernel/arch/m68k/arch_elf.cpp 2008-01-10 16:48:16 UTC (rev 23348) @@ -116,12 +116,21 @@ static inline bool +write_8(addr_t P, Elf32_Word value) +{ + // bits 7:0 + *(uint8 *)P = (uint8)value; + return true; +} + + +static inline bool write_8_check(addr_t P, Elf32_Word value) { // bits 7:0 if ((value & 0xffffff00) && (~value & 0xffffff80)) return false; - *(Elf32_Half*)P = (Elf32_Half)value; + *(uint8 *)P = (uint8)value; return true; } @@ -292,14 +301,14 @@ case R_68K_PLT16: REQUIRE_PLT; - if (write_16(P, (L + A - P))) + if (write_16_check(P, (L + A - P))) break; dprintf("R_68K_PLT16 overflow\n"); return B_BAD_DATA; case R_68K_PLT8: REQUIRE_PLT; - if (write_8(P, (L + A - P))) + if (write_8_check(P, (L + A - P))) break; dprintf("R_68K_PLT8 overflow\n"); return B_BAD_DATA; @@ -311,14 +320,14 @@ case R_68K_PLT16O: REQUIRE_PLT; - if (write_16(P, (L + A))) + if (write_16_check(P, (L + A))) break; dprintf("R_68K_PLT16O overflow\n"); return B_BAD_DATA; case R_68K_PLT8O: REQUIRE_PLT; - if (write_8(P, (L + A))) + if (write_8_check(P, (L + A))) break; dprintf("R_68K_PLT8O overflow\n"); return B_BAD_DATA; From marcusoverhagen at mail.berlios.de Thu Jan 10 21:39:31 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Thu, 10 Jan 2008 21:39:31 +0100 Subject: [Haiku-commits] r23349 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801102039.m0AKdV7r025428@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-10 21:39:30 +0100 (Thu, 10 Jan 2008) New Revision: 23349 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23349&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/emulation.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/pio.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c Log: some cleanup to make it compile again Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-10 16:48:16 UTC (rev 23348) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-10 20:39:30 UTC (rev 23349) @@ -130,15 +130,14 @@ status_t ata_pio_wait_drdy(ide_device_info *device) { - ASSERT(bus->state == ata_state_pio); - return ata_wait(bus, ide_status_drdy, ide_status_bsy, false, device->bus->pio_timeout); + ASSERT(device->bus->state == ata_state_pio); + return ata_wait(device->bus, ide_status_drdy, ide_status_bsy, false, device->pio_timeout); } - status_t -ata_send_command(ide_device_info *device, ata_request *request, - bool need_drdy, uint32 timeout, ata_bus_state new_state) +ata_send_command(ide_device_info *device, ata_request *request, bool need_drdy, + uint32 timeout, ata_bus_state new_state) { ide_bus_info *bus = device->bus; @@ -170,13 +169,13 @@ // resetting the device here will discard current configuration, // it's better when the SCSI bus manager requests an external reset. TRACE("device selection timeout\n"); - device->subsys_status = SCSI_SEL_TIMEOUT; + ata_request_set_status(request, SCSI_SEL_TIMEOUT); return B_ERROR; } if (need_drdy && (bus->controller->get_altstatus(bus->channel_cookie) & ide_status_drdy) == 0) { TRACE("drdy not set\n"); - device->subsys_status = SCSI_SEQUENCE_FAIL; + ata_request_set_status(request, SCSI_SEQUENCE_FAIL); return B_ERROR; } @@ -200,7 +199,8 @@ ASSERT(bus->state == ata_state_busy); bus->state = new_state; - bus->pio_timeout = timeout * 1000; + if (request) + request->device->pio_timeout = timeout * 1000; IDE_UNLOCK(bus); @@ -212,7 +212,7 @@ bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3 | ide_devctrl_nien); err: - device->subsys_status = SCSI_HBA_ERR; + ata_request_set_status(request, SCSI_HBA_ERR); IDE_UNLOCK(bus); return B_ERROR; } @@ -220,6 +220,7 @@ status_t ata_finish_command(ide_device_info *device) { + return B_OK; } @@ -292,7 +293,7 @@ dprintf("ATA: reset_bus: timeout\n"); goto error; } -timeout + if (controller->read_command_block_regs(channel, &tf, ide_mask_sector_count | ide_mask_LBA_low | ide_mask_LBA_mid | ide_mask_LBA_high | ide_mask_error) != B_OK) goto error; @@ -339,6 +340,7 @@ static bool check_rw_status(ide_device_info *device, bool drqStatus) { +/* ide_bus_info *bus = device->bus; int status; @@ -353,7 +355,7 @@ device->subsys_status = SCSI_SEQUENCE_FAIL; return false; } - +*/ return true; } @@ -456,6 +458,7 @@ void ata_dpc_DMA(ata_request *request) { +/* ide_device_info *device = request->device; bool dma_success, dev_err; @@ -480,6 +483,7 @@ // reset queue in case queuing is active finish_reset_queue(request); } +*/ } @@ -578,8 +582,7 @@ track_size = infoblock->current_heads * infoblock->current_sectors; if (track_size == 0) { - set_sense(device, - SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_MEDIUM_FORMAT_CORRUPTED); + ata_request_set_sense(request, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_MEDIUM_FORMAT_CORRUPTED); return false; } @@ -600,7 +603,7 @@ return true; err: - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_CDB_FIELD); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_CDB_FIELD); return false; } @@ -669,7 +672,7 @@ if (request->uses_dma) abort_dma(device, request); - finish_checksense(request); + ata_request_finish(request, false); return; err_send: @@ -678,7 +681,9 @@ if (request->uses_dma) abort_dma(device, request); - finish_reset_queue(request); +// finish_reset_queue(request); + ata_request_finish(request, false); + } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-10 16:48:16 UTC (rev 23348) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-10 20:39:30 UTC (rev 23349) @@ -74,6 +74,8 @@ ata_request_set_status(ata_request *request, uint8 status) { ASSERT(status != SCSI_REQ_CMP); + if (!request) + return; request->ccb->subsys_status = status; } @@ -81,6 +83,8 @@ void ata_request_set_sense(ata_request *request, uint8 key, uint16 asc_acq) { + if (!request) + return; request->senseKey = key; request->senseAsc = asc_acq >> 8; request->senseAscq = asc_acq & 0xff; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-10 16:48:16 UTC (rev 23348) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-10 20:39:30 UTC (rev 23349) @@ -25,7 +25,10 @@ // so this is a safe bet #define IDE_ATAPI_BUFFER_SIZE 512 +#define TRACE dprintf +#define FLOW dprintf + /*! Set sense according to error reported by device return: true - device reported error @@ -45,7 +48,7 @@ if (bus->controller->read_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_error) != B_OK) { - device->subsys_status = SCSI_HBA_ERR; + ata_request_set_status(request, SCSI_HBA_ERR); return true; } @@ -77,10 +80,14 @@ // tell SCSI layer that sense must be requested // (we don't take care of auto-sense ourselve) - device->subsys_status = SCSI_REQ_CMP_ERR; + + // XXX broken! + +/* device->subsys_status = SCSI_REQ_CMP_ERR; request->ccb->device_status = SCSI_STATUS_CHECK_CONDITION; // reset pending emulated sense - its overwritten by a real one device->combined_sense = 0; +*/ return true; } @@ -113,7 +120,7 @@ if (!device->tf.packet_res.cmd_or_data || device->tf.packet_res.input_or_output || (status & ide_status_drq) == 0) { - device->subsys_status = SCSI_SEQUENCE_FAIL; + ata_request_set_status(request, SCSI_SEQUENCE_FAIL); goto err; } @@ -125,7 +132,7 @@ true) != B_OK) { SHOW_ERROR0( 1, "Error sending command packet" ); - device->subsys_status = SCSI_HBA_ERR; + ata_request_set_status(request, SCSI_HBA_ERR); goto err_cancel_timer; } @@ -186,7 +193,7 @@ SHOW_FLOW0(3, "data transmission"); if (device->tf.packet_res.cmd_or_data) { - device->subsys_status = SCSI_SEQUENCE_FAIL; + ata_request_set_status(request, SCSI_SEQUENCE_FAIL); goto err; } @@ -233,7 +240,7 @@ if (err == B_ERROR) { SHOW_ERROR0(2, "Error during PIO transmission"); - device->subsys_status = SCSI_HBA_ERR; + ata_request_set_status(request, SCSI_HBA_ERR); goto err_cancel_timer; } @@ -376,7 +383,7 @@ if (!device->tf.packet_res.cmd_or_data || device->tf.packet_res.input_or_output) { - device->subsys_status = SCSI_SEQUENCE_FAIL; + ata_request_set_status(request, SCSI_SEQUENCE_FAIL); goto err_setup; } @@ -427,7 +434,7 @@ IDE_UNLOCK(bus); err_packet: - device->subsys_status = SCSI_HBA_ERR; + data_request_set_status(request, SCSI_HBA_ERR); err_setup: if (request->uses_dma) @@ -442,6 +449,8 @@ void atapi_exec_io(ide_device_info *device, ata_request *request) { + TRACE("atapi_exec_io\n"); +/* scsi_ccb *ccb = request->ccb; SHOW_FLOW(3, "command=%x", request->ccb->cdb[0]); @@ -463,6 +472,7 @@ send_packet(device, request, (ccb->flags & SCSI_DIR_MASK) == SCSI_DIR_OUT); } +*/ } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-10 16:48:16 UTC (rev 23348) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-10 20:39:30 UTC (rev 23349) @@ -24,31 +24,53 @@ #define TRACE(x...) dprintf("IDE: " x) -/** cleanup links devices on one bus when is deleted */ -static void -cleanup_device_links(ide_device_info *device) +static void setup_device_links(ide_bus_info *bus, ide_device_info *device); +static void cleanup_device_links(ide_device_info *device); + + +/** create device info */ +ide_device_info * +create_device(ide_bus_info *bus, bool is_device1) { - ide_bus_info *bus = device->bus; + ide_device_info *device; - TRACE("cleanup_device_links: device %p\n", device); + TRACE("create_device: bus %p, device-number %d\n", bus, is_device1); - bus->devices[device->is_device1] = NULL; + device = (ide_device_info *)malloc(sizeof(*device)); + if (device == NULL) + return NULL; - if (device->other_device) { - if (device->other_device != device) { - device->other_device->other_device = device->other_device; - bus->first_device = device->other_device; - } else - bus->first_device = NULL; - } + memset(device, 0, sizeof(*device)); - device->other_device = NULL; + device->is_device1 = is_device1; + device->target_id = is_device1; + + setup_device_links(bus, device); + + device->DMA_failures = 0; + device->num_failed_send = 0; + + device->total_sectors = 0; + + device->requestActive = NULL; + device->requestFree = (ata_request *)malloc(sizeof(ata_request)); + ata_request_init(device->requestFree, device); + + // disable interrupts + bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3 | ide_devctrl_nien); + + // make sure LBA bit is set, and initialize device selection flag + device->tf.chs.head = 0; + device->tf.chs.mode = ide_mode_lba; + device->tf.chs.device = is_device1; + bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_device_head); + + return device; } /** destroy device info */ - void destroy_device(ide_device_info *device) { @@ -57,6 +79,11 @@ // paranoia device->exec_io = NULL; + if (device->requestActive) + dprintf("destroy_device: Warning request still active\n"); + free(device->requestFree); + + cleanup_device_links(device); free(device); @@ -64,7 +91,6 @@ /** setup links between the devices on one bus */ - static void setup_device_links(ide_bus_info *bus, ide_device_info *device) { @@ -72,63 +98,18 @@ device->bus = bus; bus->devices[device->is_device1] = device; - - device->other_device = device; - - if (device->is_device1) { - if (bus->devices[0]) { - device->other_device = bus->devices[0]; - bus->devices[0]->other_device = device; - } - } else { - if (bus->devices[1]) { - device->other_device = bus->devices[1]; - bus->devices[1]->other_device = device; - } - } - - if (bus->first_device == NULL) - bus->first_device = device; } -/** create device info */ - -ide_device_info * -create_device(ide_bus_info *bus, bool is_device1) +/** cleanup links devices on one bus when is deleted */ +static void +cleanup_device_links(ide_device_info *device) { - ide_device_info *device; + ide_bus_info *bus = device->bus; - TRACE("create_device: bus %p, device-number %d\n", bus, is_device1); + TRACE("cleanup_device_links: device %p\n", device); - device = (ide_device_info *)malloc(sizeof(*device)); - if (device == NULL) - return NULL; - - memset(device, 0, sizeof(*device)); - - device->is_device1 = is_device1; - device->target_id = is_device1; - - setup_device_links(bus, device); - - device->DMA_failures = 0; - device->num_failed_send = 0; - - device->combined_sense = 0; - - device->total_sectors = 0; - - // disable interrupts - bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3 | ide_devctrl_nien); - - // make sure LBA bit is set, and initialize device selection flag - device->tf.chs.head = 0; - device->tf.chs.mode = ide_mode_lba; - device->tf.chs.device = is_device1; - bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_device_head); - - return device; + bus->devices[device->is_device1] = NULL; } #if B_HOST_IS_LENDIAN @@ -154,7 +135,7 @@ /** prepare infoblock for further use, i.e. fix endianess */ static void -prep_infoblock(ide_device_info *device) +fix_infoblock_endian(ide_device_info *device) { ide_device_infoblock *infoblock = &device->infoblock; @@ -183,9 +164,7 @@ return B_ERROR; } - device->subsys_status = SCSI_REQ_CMP; - - prep_infoblock(device); + fix_infoblock_endian(device); return B_OK; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/emulation.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/emulation.c 2008-01-10 16:48:16 UTC (rev 23348) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/emulation.c 2008-01-10 20:39:30 UTC (rev 23349) @@ -12,44 +12,9 @@ #include "ide_sim.h" #include - #include -/*! Emulate REQUEST SENSE */ -void -ide_request_sense(ide_device_info *device, ata_request *request) -{ - scsi_ccb *ccb = request->ccb; - scsi_cmd_request_sense *cmd = (scsi_cmd_request_sense *)ccb->cdb; - scsi_sense sense; - uint32 transferSize; - - // cannot use finish_checksense here, as data is not copied into autosense buffer - // but into normal data buffer, SCSI result is GOOD and CAM status is REQ_CMP - - if (device->combined_sense) - create_sense(device, &sense); - else - memset(&sense, 0, sizeof(sense)); - - copy_sg_data(ccb, 0, cmd->allocation_length, &sense, sizeof(sense), false); - - // reset sense information on read - device->combined_sense = 0; - - transferSize = min(sizeof(sense), cmd->allocation_length); - transferSize = min(transferSize, ccb->data_length); - - ccb->data_resid = ccb->data_length - transferSize; - - // normally, all flags are set to "success", but for Request Sense - // this would have overwritten the sense we want to read - device->subsys_status = SCSI_REQ_CMP; - ccb->device_status = SCSI_STATUS_GOOD; -} - - /*! Copy data between ccb data and buffer ccb - ccb to copy data from/to offset - offset of data in ccb Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-10 16:48:16 UTC (rev 23348) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-10 20:39:30 UTC (rev 23349) @@ -17,6 +17,7 @@ #include "ide_device_infoblock.h" #include #include +#include "ata_request.h" #define debug_level_error 2 #define debug_level_info 1 @@ -42,8 +43,8 @@ extern device_manager_info *pnp; +extern scsi_for_sim_interface *scsi; - typedef struct ide_bus_info ide_bus_info; @@ -59,30 +60,9 @@ struct ide_bus_info *bus; } ide_bus_timer_info; -// ide request -typedef struct ata_request { - struct ide_device_info * device; - scsi_ccb * ccb; // basic scsi request - uint8 is_write : 1; // true for write request - uint8 uses_dma : 1; // true if using dma - uint8 packet_irq : 1; // true if waiting for command packet irq -} ata_request; -//void init_ata_request(ata_request *request, struct ide_device_info *device, scsi_ccb *ccb); - -static inline void -init_ata_request(ata_request *request, struct ide_device_info *device, scsi_ccb *ccb) -{ - request->device = device; - request->ccb = ccb; - request->is_write = 0; - request->uses_dma = 0; - request->packet_irq = 0; -} - - typedef struct ide_device_info { struct ide_bus_info *bus; @@ -98,15 +78,10 @@ uint8 DMA_failures; // DMA failures in a row uint8 num_failed_send; // number of consequetive send problems - // next two error codes are copied to request on finish_request & co. - uint8 subsys_status; // subsystem status of current request - uint32 new_combined_sense; // emulated sense of current request - // pending error codes - uint32 combined_sense; // emulated sense of device + struct ata_request * requestActive; + struct ata_request * requestFree; - struct ide_device_info *other_device; // other device on same bus - // entry for scsi's exec_io request void (*exec_io)( struct ide_device_info *device, struct ata_request *request ); @@ -172,10 +147,6 @@ ata_bus_state state; // current state of bus - struct ata_request * requestActive; - struct ata_request * requestFree; - - benaphore status_report_ben; // to lock when you report XPT about bus state // i.e. during requeue, resubmit or finished @@ -188,7 +159,6 @@ ide_device_info *active_device; ide_device_info *devices[2]; - ide_device_info *first_device; uchar path_id; @@ -227,6 +197,7 @@ status_t ata_wait_for_drq(ide_bus_info *bus); status_t ata_wait_for_drqdown(ide_bus_info *bus); status_t ata_wait_for_drdy(ide_bus_info *bus); +status_t ata_pio_wait_drdy(ide_device_info *device); status_t ata_reset_bus(ide_bus_info *bus, bool *_devicePresent0, uint32 *_sigDev0, bool *_devicePresent1, uint32 *_sigDev1); status_t ata_reset_device(ide_device_info *device, bool *_devicePresent); status_t ata_send_command(ide_device_info *device, ata_request *request, bool need_drdy, uint32 timeout, ata_bus_state new_state); @@ -295,8 +266,14 @@ status_t read_PIO_block(ata_request *request, int length); status_t write_PIO_block(ata_request *request, int length); +// scsi +struct scsi_sense; +void scsi_set_sense(struct scsi_sense *sense, const ata_request *request); + + + // sync.c // timeout in seconds (according to CAM) Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-10 16:48:16 UTC (rev 23348) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-10 20:39:30 UTC (rev 23349) @@ -283,15 +283,16 @@ } bus->scsi_cookie = user_cookie; - bus->state = ata_state_idle; bus->timer.bus = bus; if ((status = scsi->alloc_dpc(&bus->irq_dpc)) < B_OK) goto err1; + bus->state = ata_state_idle; bus->active_device = NULL; - bus->devices[0] = bus->devices[1] = NULL; + bus->devices[0] = NULL; + bus->devices[1] = NULL; status = INIT_BEN(&bus->status_report_ben, "ide_status_report"); if (status < B_OK) Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.h 2008-01-10 16:48:16 UTC (rev 23348) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.h 2008-01-10 20:39:30 UTC (rev 23349) @@ -13,66 +13,9 @@ #ifndef __IDE_SIM_H__ #define __IDE_SIM_H__ - #include "scsi_cmds.h" extern scsi_for_sim_interface *scsi; extern scsi_sim_interface ide_sim_module; -// set sense of current ccb -static inline void -set_sense(ide_device_info *device, int sense_key, int sense_asc) -{ - device->new_combined_sense = (sense_key << 16) | sense_asc; -} - -// retrieve key from combined sense -static inline uint8 -decode_sense_key(uint32 combined_sense) -{ - return (combined_sense >> 16) & 0xff; -} - -// retrieve asc from combined sense -static inline uint8 -decode_sense_asc(uint32 combined_sense) -{ - return (combined_sense >> 8) & 0xff; -} - -// retrieve ascq from combined sense -static inline uint8 -decode_sense_ascq(uint32 combined_sense) -{ - return combined_sense & 0xff; -} - -// retrieve asc and ascq from combined sense -static inline uint16 -decode_sense_asc_ascq(uint32 combined_sense) -{ - return combined_sense & 0xffff; -} - -void finish_request(ata_request *request, bool resubmit); -void finish_reset_queue(ata_request *request); -void finish_retry(ata_request *request); -void finish_all_requests(ide_device_info *device, ata_request *ignore, - int subsys_status, bool resubmit); -void finish_checksense(ata_request *request); - - -// start ccb by resetting sense -static inline void -start_request(ide_device_info *device, ata_request *request) -{ - device->new_combined_sense = 0; - device->subsys_status = SCSI_REQ_CMP; - request->ccb->device_status = SCSI_STATUS_GOOD; -} - - -void create_sense(ide_device_info *device, scsi_sense *sense); - - #endif Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/pio.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/pio.c 2008-01-10 16:48:16 UTC (rev 23348) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/pio.c 2008-01-10 20:39:30 UTC (rev 23349) @@ -153,7 +153,7 @@ if (vm_get_physical_page(physicalAddress, &virtualAddress, PHYSICAL_PAGE_CAN_WAIT) != B_OK) { // ouch: this should never ever happen - set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_INTERNAL_FAILURE); +//xxx fix this set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_INTERNAL_FAILURE); return B_ERROR; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-10 16:48:16 UTC (rev 23348) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-10 20:39:30 UTC (rev 23349) @@ -230,7 +230,7 @@ device->tf_param_mask = 0; device->tf.write.command = IDE_CMD_GET_MEDIA_STATUS; - if (ata_send_command(request, true, 15, ata_state_pio) != B_OK) { + if (ata_send_command(device, request, true, 15, ata_state_pio) != B_OK) { return; } From marcusoverhagen at mail.berlios.de Thu Jan 10 21:50:26 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Thu, 10 Jan 2008 21:50:26 +0100 Subject: [Haiku-commits] r23350 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801102050.m0AKoQRo026471@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-10 21:50:24 +0100 (Thu, 10 Jan 2008) New Revision: 23350 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23350&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c Log: fixed bugs Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-10 20:39:30 UTC (rev 23349) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-10 20:50:24 UTC (rev 23350) @@ -163,8 +163,6 @@ ata_select(device); - bus->active_device = device; - if (ata_wait(bus, 0, ide_status_bsy | ide_status_drq, false, 50000) != B_OK) { // resetting the device here will discard current configuration, // it's better when the SCSI bus manager requests an external reset. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-10 20:39:30 UTC (rev 23349) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-10 20:50:24 UTC (rev 23350) @@ -31,7 +31,7 @@ device->bus->state = ata_state_busy; device->bus->active_device = device; - + request = device->requestFree; device->requestActive = request; device->requestFree = NULL; @@ -50,7 +50,8 @@ request->uses_dma = 0; request->packet_irq = 0; - ASSERT(request->ccb->subsys_status == SCSI_REQ_INPROG); + // XXX the following always triggers. Why? + // ASSERT(request->ccb->subsys_status == SCSI_REQ_INPROG); // pretend success request->ccb->subsys_status = SCSI_REQ_CMP; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-10 20:39:30 UTC (rev 23349) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-10 20:50:24 UTC (rev 23350) @@ -32,10 +32,11 @@ #include #include -#define FLOW dprintf +//#define FLOW dprintf +#define FLOW(x...) #define TRACE dprintf +//#define TRACE(x...) - scsi_for_sim_interface *scsi; @@ -68,12 +69,12 @@ ata_request_start(&request, device, ccb); if (request) { - FLOW("calling exec_io: %p, %d:%d\n", bus, ccb->target_id, ccb->target_lun); + TRACE("calling exec_io: %p, %d:%d\n", bus, ccb->target_id, ccb->target_lun); device->exec_io(device, request); return; } - FLOW("Bus busy\n"); + TRACE("Bus busy\n"); ACQUIRE_BEN(&bus->status_report_ben); scsi->requeue(ccb, true); RELEASE_BEN(&bus->status_report_ben); From mmu_man at mail.berlios.de Thu Jan 10 21:54:56 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 21:54:56 +0100 Subject: [Haiku-commits] r23351 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102054.m0AKstmP026797@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 21:54:55 +0100 (Thu, 10 Jan 2008) New Revision: 23351 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23351&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp haiku/trunk/src/system/boot/platform/atari_m68k/console.h Log: Add a console implementation. Added: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 20:50:24 UTC (rev 23350) +++ haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 20:54:55 UTC (rev 23351) @@ -0,0 +1,295 @@ +/* + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT license. + * + * Author: + * Fran?ois Revol, revol at free.fr. + */ + +#include +#include +#include "toscalls.h" +#include + +#include "Handle.h" +#include "console.h" + + +// TOS emulates a VT52 + +class ConsoleHandle : public Handle { + public: + ConsoleHandle(); + + virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, + size_t bufferSize); + virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, + size_t bufferSize); + int16 f +}; + +class InputConsoleHandle : public ConsoleHandle { + public: + InputConsoleHandle(); + + virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, + size_t bufferSize); + + void PutChar(char c); + void PutChars(const char *buffer, int count); + char GetChar(); + + private: + enum { BUFFER_SIZE = 32 }; + + char fBuffer[BUFFER_SIZE]; + int fStart; + int fCount; +}; + + +static InputConsoleHandle sInput; +static ConsoleHandle sOutput; +FILE *stdin, *stdout, *stderr; + + +ConsoleHandle::ConsoleHandle() + : Handle() +{ +} + + +ssize_t +ConsoleHandle::ReadAt(void */*cookie*/, off_t /*pos*/, void *buffer, + size_t bufferSize) +{ + // don't seek in character devices + // not implemented (and not yet? needed) + return B_ERROR; +} + + +ssize_t +ConsoleHandle::WriteAt(void */*cookie*/, off_t /*pos*/, const void *buffer, + size_t bufferSize) +{ + const char *string = (const char *)buffer; + + // be nice to our audience and replace single "\n" with "\r\n" + + for (i = 0; i < bufferSize; i++) { + if (string[i] == '\n') + Bconout(fHandle, '\r'); + Bconout(fHandle, string[i]); + } + + return bufferSize; +} + + +// #pragma mark - + + +InputConsoleHandle::InputConsoleHandle() + : ConsoleHandle() + , fStart(0) + , fCount(0) +{ +} + + +ssize_t +InputConsoleHandle::ReadAt(void */*cookie*/, off_t /*pos*/, void *_buffer, + size_t bufferSize) +{ + char *buffer = (char*)_buffer; + + // copy buffered bytes first + int bytesTotal = 0; + while (bufferSize > 0 && fCount > 0) { + *buffer++ = GetChar(); + bytesTotal++; + bufferSize--; + } + + // read from console + if (bufferSize > 0) { + ssize_t bytesRead = ConsoleHandle::ReadAt(NULL, 0, buffer, bufferSize); + if (bytesRead < 0) + return bytesRead; + bytesTotal += bytesRead; + } + + return bytesTotal; +} + + +void +InputConsoleHandle::PutChar(char c) +{ + if (fCount >= BUFFER_SIZE) + return; + + int pos = (fStart + fCount) % BUFFER_SIZE; + fBuffer[pos] = c; + fCount++; +} + + +void +InputConsoleHandle::PutChars(const char *buffer, int count) +{ + for (int i = 0; i < count; i++) + PutChar(buffer[i]); +} + + +char +InputConsoleHandle::GetChar() +{ + if (fCount == 0) + return 0; + + fCount--; + char c = fBuffer[fStart]; + fStart = (fStart + 1) % BUFFER_SIZE; + return c; +} + + +// #pragma mark - + + +status_t +console_init(void) +{ + sInput.SetHandle(DEV_CONSOLE); + sOutput.SetHandle(DEV_CONSOLE); + + // now that we're initialized, enable stdio functionality + stdin = (FILE *)&sInput; + stdout = stderr = (FILE *)&sOutput; + + return B_OK; +} + + +// #pragma mark - + + +void +console_clear_screen(void) +{ + stdin->WriteAt(NULL, 0LL, "\033E", 2); +} + + +int32 +console_width(void) +{ + int columnCount = 80; //XXX: check video mode + return columnCount; +} + + +int32 +console_height(void) +{ + int lineCount = 25; //XXX: check video mode + return lineCount; +} + + +void +console_set_cursor(int32 x, int32 y) +{ + char buff[] = "\033Y "; + buff[3] += (char)x; + buff[2] += (char)y; + stdin->WriteAt(NULL, 0LL, buff, 4); +} + + +static int +translate_color(int32 color) +{ + /* + r g b + 0: 0 0 0 // black + 1: 0 0 aa // dark blue + 2: 0 aa 0 // dark green + 3: 0 aa aa // cyan + 4: aa 0 0 // dark red + 5: aa 0 aa // purple + 6: aa 55 0 // brown + 7: aa aa aa // light gray + 8: 55 55 55 // dark gray + 9: 55 55 ff // light blue + a: 55 ff 55 // light green + b: 55 ff ff // light cyan + c: ff 55 55 // light red + d: ff 55 ff // magenta + e: ff ff 55 // yellow + f: ff ff ff // white + */ + if (color >= 0 && color < 16) + return color; + return 0; +} + + +void +console_set_color(int32 foreground, int32 background) +{ + // Note: Toggling the cursor doesn't seem to help. We still get cursor + // artifacts. + of_interpret("toggle-cursor" + " to foreground-color" + " to background-color" + " toggle-cursor", + 2, 0, translate_color(foreground), translate_color(background)); +} + + +int +console_wait_for_key(void) +{ + // wait for a key + char buffer[3]; + ssize_t bytesRead; + do { + bytesRead = sInput.ReadAt(NULL, 0, buffer, 3); + if (bytesRead < 0) + return 0; + } while (bytesRead == 0); + + // translate the ESC sequences for cursor keys + if (bytesRead == 3 && buffer[0] == 27 && buffer [1] == 91) { + switch (buffer[2]) { + case 65: + return TEXT_CONSOLE_KEY_UP; + case 66: + return TEXT_CONSOLE_KEY_DOWN; + case 67: + return TEXT_CONSOLE_KEY_RIGHT; + case 68: + return TEXT_CONSOLE_KEY_LEFT; +// TODO: Translate the codes for the following keys. Unfortunately my OF just +// returns a '\0' character. :-/ +// TEXT_CONSOLE_KEY_PAGE_UP, +// TEXT_CONSOLE_KEY_PAGE_DOWN, +// TEXT_CONSOLE_KEY_HOME, +// TEXT_CONSOLE_KEY_END, + + default: + break; + } + } + + // put back unread chars + if (bytesRead > 1) + sInput.PutChars(buffer + 1, bytesRead - 1); + + return buffer[0]; +} + Added: haiku/trunk/src/system/boot/platform/atari_m68k/console.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/console.h 2008-01-10 20:50:24 UTC (rev 23350) +++ haiku/trunk/src/system/boot/platform/atari_m68k/console.h 2008-01-10 20:54:55 UTC (rev 23351) @@ -0,0 +1,24 @@ +/* + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT license. + * + * Author: + * Fran?ois Revol, revol at free.fr. + */ + +#ifndef CONSOLE_H +#define CONSOLE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern status_t console_init(void); + +#ifdef __cplusplus +} +#endif + +#endif /* CONSOLE_H */ From axeld at mail.berlios.de Thu Jan 10 22:05:01 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 10 Jan 2008 22:05:01 +0100 Subject: [Haiku-commits] r23352 - haiku/trunk/src/apps/diskprobe Message-ID: <200801102105.m0AL51TP028659@sheep.berlios.de> Author: axeld Date: 2008-01-10 22:05:00 +0100 (Thu, 10 Jan 2008) New Revision: 23352 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23352&view=rev Modified: haiku/trunk/src/apps/diskprobe/AttributeWindow.cpp haiku/trunk/src/apps/diskprobe/FileWindow.cpp haiku/trunk/src/apps/diskprobe/ProbeView.cpp haiku/trunk/src/apps/diskprobe/ProbeView.h haiku/trunk/src/apps/diskprobe/TypeEditors.cpp haiku/trunk/src/apps/diskprobe/TypeEditors.h Log: * Some refactoring and cleanups. * Started a "View As" feature which will allow you to use the type editor for the file itself - not yet enabled (or working). Modified: haiku/trunk/src/apps/diskprobe/AttributeWindow.cpp =================================================================== --- haiku/trunk/src/apps/diskprobe/AttributeWindow.cpp 2008-01-10 20:54:55 UTC (rev 23351) +++ haiku/trunk/src/apps/diskprobe/AttributeWindow.cpp 2008-01-10 21:05:00 UTC (rev 23352) @@ -49,9 +49,9 @@ fRawTab(-1) { ContainerView()->MoveBy(-ContainerView()->Frame().left, - TabHeight() + 1 - ContainerView()->Frame().top); + TabHeight() + 1 - ContainerView()->Frame().top); fNoEditorView = new BStringView(ContainerView()->Bounds(), "Type Editor", - "No type editor available", B_FOLLOW_NONE); + "No type editor available", B_FOLLOW_NONE); fNoEditorView->ResizeToPreferred(); fNoEditorView->SetAlignment(B_ALIGN_CENTER); fTypeEditorView = fNoEditorView; Modified: haiku/trunk/src/apps/diskprobe/FileWindow.cpp =================================================================== --- haiku/trunk/src/apps/diskprobe/FileWindow.cpp 2008-01-10 20:54:55 UTC (rev 23351) +++ haiku/trunk/src/apps/diskprobe/FileWindow.cpp 2008-01-10 21:05:00 UTC (rev 23352) @@ -88,6 +88,7 @@ fProbeView->AddSaveMenuItems(menu, 4); fProbeView->AddPrintMenuItems(menu, menu->CountItems() - 4); + fProbeView->AddViewAsMenuItems(); fProbeView->UpdateSizeLimits(); } Modified: haiku/trunk/src/apps/diskprobe/ProbeView.cpp =================================================================== --- haiku/trunk/src/apps/diskprobe/ProbeView.cpp 2008-01-10 20:54:55 UTC (rev 23351) +++ haiku/trunk/src/apps/diskprobe/ProbeView.cpp 2008-01-10 21:05:00 UTC (rev 23352) @@ -1,13 +1,15 @@ /* - * Copyright 2004-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ #include "ProbeView.h" -#include "DataView.h" -#include "DiskProbe.h" +#include +#include +#include + #include #include #include @@ -35,11 +37,10 @@ #include #include -#include -#include -#include +#include "DataView.h" +#include "DiskProbe.h" +#include "TypeEditors.h" - #ifndef __HAIKU__ # define DRAW_SLIDER_BAR // if this is defined, the standard slider bar is replaced with @@ -55,6 +56,7 @@ static const uint32 kMsgAddBookmark = 'bmrk'; static const uint32 kMsgPrint = 'prnt'; static const uint32 kMsgPageSetup = 'pgsp'; +static const uint32 kMsgViewAs = 'vwas'; static const uint32 kMsgStopFind = 'sfnd'; @@ -184,9 +186,22 @@ }; -//---------------------- +class TypeView : public BView { + public: + TypeView(BRect rect, const char* name, int32 index, + DataEditor& editor, int32 resizingMode); + virtual ~TypeView(); + virtual void FrameResized(float width, float height); + private: + BView* fTypeEditorView; +}; + + +// #pragma mark - utility functions + + static void get_type_string(char *buffer, size_t bufferSize, type_code type) { @@ -201,7 +216,7 @@ } -// #pragma mark - +// #pragma mark - IconView IconView::IconView(BRect rect, const entry_ref *ref, bool isDevice) @@ -285,7 +300,7 @@ } -// #pragma mark - +// #pragma mark - PositionSlider PositionSlider::PositionSlider(BRect rect, const char *name, BMessage *message, @@ -407,7 +422,6 @@ PositionSlider::SetPosition(off_t position) { position /= fBlockSize; - printf("value: %ld\n", int32(1.0 * kMaxSliderLimit * position / ((fSize - 1) / fBlockSize) + 0.5)); SetValue(int32(1.0 * kMaxSliderLimit * position / ((fSize - 1) / fBlockSize) + 0.5)); } @@ -441,7 +455,7 @@ } -// #pragma mark - +// #pragma mark - HeaderView HeaderView::HeaderView(BRect frame, const entry_ref *ref, DataEditor &editor) @@ -466,7 +480,7 @@ BRect rect = Bounds(); fStopButton = new BButton(BRect(0, 0, 20, 20), B_EMPTY_STRING, "Stop", - new BMessage(kMsgStopFind), B_FOLLOW_TOP | B_FOLLOW_RIGHT); + new BMessage(kMsgStopFind), B_FOLLOW_TOP | B_FOLLOW_RIGHT); fStopButton->SetFont(&plainFont); fStopButton->ResizeToPreferred(); fStopButton->MoveTo(rect.right - 4 - fStopButton->Bounds().Width(), 4); @@ -474,7 +488,8 @@ AddChild(fStopButton); BStringView *stringView = new BStringView(BRect(50, 6, rect.right, 20), - B_EMPTY_STRING, editor.IsAttribute() ? "Attribute: " : editor.IsDevice() ? "Device: " : "File: "); + B_EMPTY_STRING, editor.IsAttribute() + ? "Attribute: " : editor.IsDevice() ? "Device: " : "File: "); stringView->SetFont(&boldFont); stringView->ResizeToPreferred(); AddChild(stringView); @@ -489,14 +504,16 @@ rect = stringView->Frame(); rect.left = rect.right; rect.right = fStopButton->Frame().right - 1; - fPathView = new BStringView(rect, B_EMPTY_STRING, string.String(), B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT); + fPathView = new BStringView(rect, B_EMPTY_STRING, string.String(), + B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT); fPathView->SetFont(&plainFont); AddChild(fPathView); float top = 28; if (editor.IsAttribute()) { top += 3; - stringView = new BStringView(BRect(50, top, frame.right, top + 15), B_EMPTY_STRING, "Attribute Type: "); + stringView = new BStringView(BRect(50, top, frame.right, top + 15), + B_EMPTY_STRING, "Attribute Type: "); stringView->SetFont(&boldFont); stringView->ResizeToPreferred(); AddChild(stringView); @@ -509,7 +526,8 @@ char buffer[16]; get_type_string(buffer, sizeof(buffer), editor.Type()); - fTypeControl = new BTextControl(rect, B_EMPTY_STRING, NULL, buffer, new BMessage(kMsgPositionUpdate)); + fTypeControl = new BTextControl(rect, B_EMPTY_STRING, NULL, buffer, + new BMessage(kMsgPositionUpdate)); fTypeControl->SetDivider(0.0); fTypeControl->SetFont(&plainFont); fTypeControl->TextView()->SetFontAndColor(&plainFont); @@ -521,7 +539,8 @@ } else fTypeControl = NULL; - stringView = new BStringView(BRect(50, top, frame.right, top + 15), B_EMPTY_STRING, "Block: "); + stringView = new BStringView(BRect(50, top, frame.right, top + 15), + B_EMPTY_STRING, "Block: "); stringView->SetFont(&boldFont); stringView->ResizeToPreferred(); AddChild(stringView); @@ -531,7 +550,8 @@ rect.right += 75; rect.OffsetBy(0, -2); // BTextControl oddities - fPositionControl = new BTextControl(rect, B_EMPTY_STRING, NULL, "0x0", new BMessage(kMsgPositionUpdate)); + fPositionControl = new BTextControl(rect, B_EMPTY_STRING, NULL, "0x0", + new BMessage(kMsgPositionUpdate)); fPositionControl->SetDivider(0.0); fPositionControl->SetFont(&plainFont); fPositionControl->TextView()->SetFontAndColor(&plainFont); @@ -563,8 +583,9 @@ rect.left = rect.right + 4; rect.right = frame.right; - stringView = new BStringView(rect, B_EMPTY_STRING, - editor.IsAttribute() ? "Attribute Offset: " : editor.IsDevice() ? "Device Offset: " : "File Offset: "); + stringView = new BStringView(rect, B_EMPTY_STRING, editor.IsAttribute() + ? "Attribute Offset: " : editor.IsDevice() + ? "Device Offset: " : "File Offset: "); stringView->SetFont(&boldFont); stringView->ResizeToPreferred(); AddChild(stringView); @@ -580,8 +601,8 @@ rect.InsetBy(3, 0); rect.top = top + 21; rect.bottom = rect.top + 12; - fPositionSlider = new PositionSlider(rect, "slider", new BMessage(kMsgSliderUpdate), - editor.FileSize(), editor.BlockSize()); + fPositionSlider = new PositionSlider(rect, "slider", + new BMessage(kMsgSliderUpdate), editor.FileSize(), editor.BlockSize()); fPositionSlider->SetModificationMessage(new BMessage(kMsgSliderUpdate)); fPositionSlider->SetBarThickness(8); fPositionSlider->ResizeToPreferred(); @@ -604,13 +625,17 @@ fPositionSlider->SetTarget(this); BMessage *message; - Window()->AddShortcut(B_HOME, B_COMMAND_KEY, message = new BMessage(kMsgPositionUpdate), this); + Window()->AddShortcut(B_HOME, B_COMMAND_KEY, + message = new BMessage(kMsgPositionUpdate), this); message->AddInt64("block", 0); - Window()->AddShortcut(B_END, B_COMMAND_KEY, message = new BMessage(kMsgPositionUpdate), this); + Window()->AddShortcut(B_END, B_COMMAND_KEY, + message = new BMessage(kMsgPositionUpdate), this); message->AddInt64("block", -1); - Window()->AddShortcut(B_PAGE_UP, B_COMMAND_KEY, message = new BMessage(kMsgPositionUpdate), this); + Window()->AddShortcut(B_PAGE_UP, B_COMMAND_KEY, + message = new BMessage(kMsgPositionUpdate), this); message->AddInt32("delta", -1); - Window()->AddShortcut(B_PAGE_DOWN, B_COMMAND_KEY, message = new BMessage(kMsgPositionUpdate), this); + Window()->AddShortcut(B_PAGE_DOWN, B_COMMAND_KEY, + message = new BMessage(kMsgPositionUpdate), this); message->AddInt32("delta", 1); } @@ -699,7 +724,8 @@ { char buffer[64]; strcpy(buffer, "of "); - FormatValue(buffer + 3, sizeof(buffer) - 3, (fFileSize + fBlockSize - 1) / fBlockSize); + FormatValue(buffer + 3, sizeof(buffer) - 3, + (fFileSize + fBlockSize - 1) / fBlockSize); fSizeView->SetText(buffer); } @@ -770,7 +796,8 @@ // If there is another message of this type in the // queue, we're just ignoring the current message. - if (Looper()->MessageQueue()->FindMessage(kMsgSliderUpdate, 0) != NULL) + if (Looper()->MessageQueue()->FindMessage(kMsgSliderUpdate, 0) + != NULL) break; // if nothing has changed, we can ignore this message as well @@ -791,7 +818,8 @@ case kMsgDataEditorFindProgress: { bool state; - if (message->FindBool("running", &state) == B_OK && fFileSize > fBlockSize) { + if (message->FindBool("running", &state) == B_OK + && fFileSize > fBlockSize) { fPositionSlider->SetEnabled(!state); if (state) { fPathView->ResizeBy(-fStopButton->Bounds().Width(), 0); @@ -827,10 +855,12 @@ if (position < 0) position += (fFileSize - 1) / fBlockSize + 1; fPosition = position * fBlockSize; - } else if (message->FindInt32("delta", &delta) == B_OK) + } else if (message->FindInt32("delta", &delta) == B_OK) { fPosition += delta * off_t(fBlockSize); - else - fPosition = strtoll(fPositionControl->Text(), NULL, 0) * fBlockSize; + } else { + fPosition = strtoll(fPositionControl->Text(), NULL, 0) + * fBlockSize; + } fPosition = (fPosition / fBlockSize) * fBlockSize; // round to block size @@ -879,16 +909,16 @@ } -// #pragma mark - +// #pragma mark - TypeMenuItem -/** The TypeMenuItem is a BMenuItem that displays a type string - * at its right border. - * It is used to display the attribute and type in the attributes menu. - * It does not mix nicely with short cuts. - */ - -TypeMenuItem::TypeMenuItem(const char *name, const char *type, BMessage *message) +/*! The TypeMenuItem is a BMenuItem that displays a type string at its + right border. + It is used to display the attribute and type in the attributes menu. + It does not mix nicely with short cuts. +*/ +TypeMenuItem::TypeMenuItem(const char *name, const char *type, + BMessage *message) : BMenuItem(name, message), fType(type) { @@ -927,22 +957,21 @@ } -// #pragma mark - +// #pragma mark - EditorLooper -/** The purpose of this looper is to off-load the editor data - * loading from the main window looper. - * It will listen to the offset changes of the editor, let - * him update its data, and will then synchronously notify - * the target. - * That way, simple offset changes will not stop the main - * looper from operating. Therefore, all offset updates - * for the editor will go through this looper. - * - * Also, it will run the find action in the editor. - */ +/*! The purpose of this looper is to off-load the editor data loading from + the main window looper. -EditorLooper::EditorLooper(const char *name, DataEditor &editor, BMessenger target) + It will listen to the offset changes of the editor, let him update its + data, and will then synchronously notify the target. + That way, simple offset changes will not stop the main looper from + operating. Therefore, all offset updates for the editor will go through + this looper. + Also, it will run the find action in the editor. +*/ +EditorLooper::EditorLooper(const char *name, DataEditor &editor, + BMessenger target) : BLooper(name), fEditor(editor), fMessenger(target), @@ -1012,7 +1041,8 @@ ssize_t dataSize; const uint8 *data; - if (message->FindData("data", B_RAW_TYPE, (const void **)&data, &dataSize) == B_OK) + if (message->FindData("data", B_RAW_TYPE, (const void **)&data, + &dataSize) == B_OK) Find(startAt, data, dataSize, caseInsensitive, progressMonitor); } @@ -1064,12 +1094,68 @@ } -// #pragma mark - +// #pragma mark - TypeView -ProbeView::ProbeView(BRect rect, entry_ref *ref, const char *attribute, const BMessage *settings) +TypeView::TypeView(BRect rect, const char* name, int32 index, + DataEditor& editor, int32 resizingMode) + : BView(rect, name, resizingMode, B_FRAME_EVENTS) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + fTypeEditorView = GetTypeEditorAt(index, Frame(), editor); + if (fTypeEditorView == NULL) { + AddChild(new BStringView(Bounds(), "Type Editor", + "Type editor not supported", B_FOLLOW_NONE)); + } else + AddChild(fTypeEditorView); + + if ((fTypeEditorView->ResizingMode() & (B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM)) + != 0) { + BRect rect = Bounds(); + + BRect frame = fTypeEditorView->Frame(); + rect.left = frame.left; + rect.top = frame.top; + if ((fTypeEditorView->ResizingMode() & B_FOLLOW_RIGHT) == 0) + rect.right = frame.right; + if ((fTypeEditorView->ResizingMode() & B_FOLLOW_BOTTOM) == 0) + rect.bottom = frame.bottom; + + fTypeEditorView->ResizeTo(rect.Width(), rect.Height()); + } +} + + +TypeView::~TypeView() +{ +} + + +void +TypeView::FrameResized(float width, float height) +{ + BRect rect = Bounds(); + BView *fTypeEditorView = fTypeEditorView; + + BPoint point = fTypeEditorView->Frame().LeftTop(); + if ((fTypeEditorView->ResizingMode() & B_FOLLOW_RIGHT) == 0) + point.x = (rect.Width() - fTypeEditorView->Bounds().Width()) / 2; + if ((fTypeEditorView->ResizingMode() & B_FOLLOW_BOTTOM) == 0) + point.y = (rect.Height() - fTypeEditorView->Bounds().Height()) / 2; + + fTypeEditorView->MoveTo(point); +} + + +// #pragma mark - ProbeView + + +ProbeView::ProbeView(BRect rect, entry_ref *ref, const char *attribute, + const BMessage *settings) : BView(rect, "probeView", B_FOLLOW_ALL, B_WILL_DRAW), fPrintSettings(NULL), + fTypeView(NULL), fLastSearch(NULL) { fEditor.SetTo(*ref, attribute); @@ -1095,7 +1181,8 @@ fDataView->SetBase((base_type)baseType); fDataView->SetFontSize(fontSize); - fScrollView = new BScrollView("scroller", fDataView, B_FOLLOW_ALL, B_WILL_DRAW, true, true); + fScrollView = new BScrollView("scroller", fDataView, B_FOLLOW_ALL, + B_WILL_DRAW, true, true); AddChild(fScrollView); fDataView->UpdateScroller(); @@ -1117,7 +1204,8 @@ float width, height; fDataView->GetPreferredSize(&width, &height); - BRect frame = Window()->ConvertFromScreen(ConvertToScreen(fHeaderView->Frame())); + BRect frame = Window()->ConvertFromScreen(ConvertToScreen( + fHeaderView->Frame())); Window()->SetSizeLimits(250, width + B_V_SCROLL_BAR_WIDTH, 200, height + frame.bottom + 4 + B_H_SCROLL_BAR_HEIGHT); @@ -1129,8 +1217,10 @@ BRect bounds = Window()->Bounds(); float minWidth, maxWidth, minHeight, maxHeight; Window()->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); - if (maxWidth < bounds.Width() || maxHeight < bounds.Height()) - Window()->ResizeTo(MIN(maxWidth, bounds.Width()), MIN(maxHeight, bounds.Height())); + if (maxWidth < bounds.Width() || maxHeight < bounds.Height()) { + Window()->ResizeTo(MIN(maxWidth, bounds.Width()), MIN(maxHeight, + bounds.Height())); + } #endif } @@ -1153,7 +1243,7 @@ void -ProbeView::UpdateAttributesMenu(BMenu *menu) +ProbeView::_UpdateAttributesMenu(BMenu *menu) { // remove old contents @@ -1206,10 +1296,10 @@ void -ProbeView::AddSaveMenuItems(BMenu *menu, int32 index) +ProbeView::AddSaveMenuItems(BMenu* menu, int32 index) { - menu->AddItem(fSaveMenuItem = new BMenuItem("Save", new BMessage(B_SAVE_REQUESTED), - 'S', B_COMMAND_KEY), index); + menu->AddItem(fSaveMenuItem = new BMenuItem("Save", + new BMessage(B_SAVE_REQUESTED), 'S'), index); fSaveMenuItem->SetTarget(this); fSaveMenuItem->SetEnabled(false); //menu->AddItem(new BMenuItem("Save As" B_UTF8_ELLIPSIS, NULL), index); @@ -1217,22 +1307,63 @@ void -ProbeView::AddPrintMenuItems(BMenu *menu, int32 index) +ProbeView::AddPrintMenuItems(BMenu* menu, int32 index) { BMenuItem *item; menu->AddItem(item = new BMenuItem("Page Setup" B_UTF8_ELLIPSIS, - new BMessage(kMsgPageSetup)), index++); + new BMessage(kMsgPageSetup)), index++); item->SetTarget(this); menu->AddItem(item = new BMenuItem("Print" B_UTF8_ELLIPSIS, - new BMessage(kMsgPrint), 'P', B_COMMAND_KEY), index++); + new BMessage(kMsgPrint), 'P'), index++); item->SetTarget(this); } void +ProbeView::AddViewAsMenuItems() +{ +#if 0 + BMenuBar* bar = Window()->KeyMenuBar(); + if (bar == NULL) + return; + + BMenuItem* item = bar->FindItem("View"); + BMenu* menu = NULL; + if (item != NULL) + menu = item->Submenu(); + else + menu = bar->SubmenuAt(bar->CountItems() - 1); + + if (menu == NULL) + return; + + menu->AddSeparatorItem(); + + BMenu* subMenu = new BMenu("View As"); + subMenu->SetRadioMode(true); + + BMessage* message = new BMessage(kMsgViewAs); + subMenu->AddItem(item = new BMenuItem("Raw", message)); + item->SetMarked(true); + + const char* name; + for (int32 i = 0; GetNthTypeEditor(i, &name) == B_OK; i++) { + message = new BMessage(kMsgViewAs); + message->AddInt32("editor index", i); + subMenu->AddItem(new BMenuItem(name, message)); + } + + subMenu->SetTargetForItems(this); + menu->AddItem(new BMenuItem(subMenu)); +#endif +} + + +void ProbeView::AttachedToWindow() { - fEditorLooper = new EditorLooper(fEditor.Ref().name, fEditor, BMessenger(fDataView)); + fEditorLooper = new EditorLooper(fEditor.Ref().name, fEditor, + BMessenger(fDataView)); fEditorLooper->Run(); fEditor.StartWatching(this); @@ -1252,13 +1383,15 @@ MoveBy(0, bar->Bounds().Height()); ResizeBy(0, -bar->Bounds().Height()); - BMenu *menu = new BMenu(fEditor.IsAttribute() ? "Attribute" : fEditor.IsDevice() ? "Device" : "File"); + BMenu *menu = new BMenu(fEditor.IsAttribute() + ? "Attribute" : fEditor.IsDevice() ? "Device" : "File"); AddSaveMenuItems(menu, 0); menu->AddSeparatorItem(); AddPrintMenuItems(menu, menu->CountItems()); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Close", new BMessage(B_CLOSE_REQUESTED), 'W', B_COMMAND_KEY)); + menu->AddItem(new BMenuItem("Close", new BMessage(B_CLOSE_REQUESTED), + 'W')); bar->AddItem(menu); } @@ -1266,26 +1399,30 @@ BMenu *menu = new BMenu("Edit"); BMenuItem *item; - menu->AddItem(fUndoMenuItem = new BMenuItem("Undo", new BMessage(B_UNDO), 'Z', B_COMMAND_KEY)); + menu->AddItem(fUndoMenuItem = new BMenuItem("Undo", new BMessage(B_UNDO), + 'Z')); fUndoMenuItem->SetEnabled(fEditor.CanUndo()); fUndoMenuItem->SetTarget(fDataView); - menu->AddItem(fRedoMenuItem = new BMenuItem("Redo", new BMessage(B_REDO), 'Z', B_COMMAND_KEY | B_SHIFT_KEY)); + menu->AddItem(fRedoMenuItem = new BMenuItem("Redo", new BMessage(B_REDO), + 'Z', B_SHIFT_KEY)); fRedoMenuItem->SetEnabled(fEditor.CanRedo()); fRedoMenuItem->SetTarget(fDataView); menu->AddSeparatorItem(); - menu->AddItem(item = new BMenuItem("Copy", new BMessage(B_COPY), 'C', B_COMMAND_KEY)); + menu->AddItem(item = new BMenuItem("Copy", new BMessage(B_COPY), 'C')); item->SetTarget(NULL, Window()); - menu->AddItem(fPasteMenuItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V', B_COMMAND_KEY)); + menu->AddItem(fPasteMenuItem = new BMenuItem("Paste", new BMessage(B_PASTE), + 'V')); fPasteMenuItem->SetTarget(NULL, Window()); - CheckClipboard(); - menu->AddItem(item = new BMenuItem("Select All", new BMessage(B_SELECT_ALL), 'A', B_COMMAND_KEY)); + _CheckClipboard(); + menu->AddItem(item = new BMenuItem("Select All", new BMessage(B_SELECT_ALL), + 'A')); item->SetTarget(NULL, Window()); menu->AddSeparatorItem(); - menu->AddItem(item = new BMenuItem("Find" B_UTF8_ELLIPSIS, new BMessage(kMsgOpenFindWindow), - 'F', B_COMMAND_KEY)); + menu->AddItem(item = new BMenuItem("Find" B_UTF8_ELLIPSIS, + new BMessage(kMsgOpenFindWindow), 'F')); item->SetTarget(this); - menu->AddItem(fFindAgainMenuItem = new BMenuItem("Find Again", new BMessage(kMsgFind), - 'G', B_COMMAND_KEY)); + menu->AddItem(fFindAgainMenuItem = new BMenuItem("Find Again", + new BMessage(kMsgFind), 'G')); fFindAgainMenuItem->SetEnabled(false); fFindAgainMenuItem->SetTarget(this); bar->AddItem(menu); @@ -1295,30 +1432,31 @@ menu = new BMenu("Block"); BMessage *message = new BMessage(kMsgPositionUpdate); message->AddInt32("delta", 1); - menu->AddItem(item = new BMenuItem("Next", message, B_RIGHT_ARROW, B_COMMAND_KEY)); + menu->AddItem(item = new BMenuItem("Next", message, B_RIGHT_ARROW)); item->SetTarget(fHeaderView); message = new BMessage(kMsgPositionUpdate); message->AddInt32("delta", -1); - menu->AddItem(item = new BMenuItem("Previous", message, B_LEFT_ARROW, B_COMMAND_KEY)); + menu->AddItem(item = new BMenuItem("Previous", message, B_LEFT_ARROW)); item->SetTarget(fHeaderView); - menu->AddItem(item = new BMenuItem("Back", new BMessage(kMsgLastPosition), 'J', B_COMMAND_KEY)); + menu->AddItem(item = new BMenuItem("Back", new BMessage(kMsgLastPosition), + 'J')); item->SetTarget(fHeaderView); BMenu *subMenu = new BMenu("Selection"); message = new BMessage(kMsgPositionUpdate); message->AddInt64("block", 0); - subMenu->AddItem(fNativeMenuItem = new BMenuItem("", message, 'K', B_COMMAND_KEY)); + subMenu->AddItem(fNativeMenuItem = new BMenuItem("", message, 'K')); fNativeMenuItem->SetTarget(fHeaderView); message = new BMessage(*message); - subMenu->AddItem(fSwappedMenuItem = new BMenuItem("", message, 'L', B_COMMAND_KEY)); + subMenu->AddItem(fSwappedMenuItem = new BMenuItem("", message, 'L')); fSwappedMenuItem->SetTarget(fHeaderView); menu->AddItem(new BMenuItem(subMenu)); - UpdateSelectionMenuItems(0, 0); + _UpdateSelectionMenuItems(0, 0); menu->AddSeparatorItem(); fBookmarkMenu = new BMenu("Bookmarks"); - fBookmarkMenu->AddItem(item = new BMenuItem("Add", new BMessage(kMsgAddBookmark), - 'B', B_COMMAND_KEY)); + fBookmarkMenu->AddItem(item = new BMenuItem("Add", + new BMessage(kMsgAddBookmark), 'B')); item->SetTarget(this); menu->AddItem(new BMenuItem(fBookmarkMenu)); bar->AddItem(menu); @@ -1328,15 +1466,16 @@ BDirectory directory; BVolume volume; - if (directory.SetTo(&fEditor.AttributeRef()) == B_OK && directory.IsRootDirectory()) + if (directory.SetTo(&fEditor.AttributeRef()) == B_OK + && directory.IsRootDirectory()) directory.GetVolume(&volume); else fEditor.File().GetVolume(&volume); - if (!fEditor.IsAttribute() - && volume.InitCheck() == B_OK && (volume.KnowsMime() || volume.KnowsAttr())) { + if (!fEditor.IsAttribute() && volume.InitCheck() == B_OK + && (volume.KnowsMime() || volume.KnowsAttr())) { bar->AddItem(menu = new BMenu("Attributes")); - UpdateAttributesMenu(menu); + _UpdateAttributesMenu(menu); } // "View" menu @@ -1348,14 +1487,14 @@ subMenu = new BMenu("Base"); message = new BMessage(kMsgBaseType); message->AddInt32("base_type", kDecimalBase); - subMenu->AddItem(item = new BMenuItem("Decimal", message, 'D', B_COMMAND_KEY)); + subMenu->AddItem(item = new BMenuItem("Decimal", message, 'D')); item->SetTarget(this); if (fHeaderView->Base() == kDecimalBase) item->SetMarked(true); message = new BMessage(kMsgBaseType); message->AddInt32("base_type", kHexBase); - subMenu->AddItem(item = new BMenuItem("Hex", message, 'H', B_COMMAND_KEY)); + subMenu->AddItem(item = new BMenuItem("Hex", message, 'H')); item->SetTarget(this); if (fHeaderView->Base() == kHexBase) item->SetMarked(true); @@ -1371,8 +1510,10 @@ for (uint32 i = 0; i < sizeof(blockSizes) / sizeof(blockSizes[0]); i++) { char buffer[32]; snprintf(buffer, sizeof(buffer), "%ld%s", blockSizes[i], - fEditor.IsDevice() && fEditor.BlockSize() == blockSizes[i] ? " (native)" : ""); - subMenu->AddItem(item = new BMenuItem(buffer, message = new BMessage(kMsgBlockSize))); + fEditor.IsDevice() && fEditor.BlockSize() == blockSizes[i] + ? " (native)" : ""); + subMenu->AddItem(item = new BMenuItem(buffer, + message = new BMessage(kMsgBlockSize))); message->AddInt32("block_size", blockSizes[i]); if (fEditor.BlockSize() == blockSizes[i]) item->SetMarked(true); @@ -1381,7 +1522,8 @@ // if the device has some weird block size, we'll add it here, too char buffer[32]; snprintf(buffer, sizeof(buffer), "%ld (native)", fEditor.BlockSize()); - subMenu->AddItem(item = new BMenuItem(buffer, message = new BMessage(kMsgBlockSize))); + subMenu->AddItem(item = new BMenuItem(buffer, + message = new BMessage(kMsgBlockSize))); message->AddInt32("block_size", fEditor.BlockSize()); item->SetMarked(true); } @@ -1400,13 +1542,15 @@ for (uint32 i = 0; i < sizeof(fontSizes) / sizeof(fontSizes[0]); i++) { char buffer[16]; snprintf(buffer, sizeof(buffer), "%ld", fontSizes[i]); - subMenu->AddItem(item = new BMenuItem(buffer, message = new BMessage(kMsgFontSize))); + subMenu->AddItem(item = new BMenuItem(buffer, + message = new BMessage(kMsgFontSize))); message->AddFloat("font_size", fontSizes[i]); if (fontSizes[i] == fontSize) item->SetMarked(true); } subMenu->AddSeparatorItem(); - subMenu->AddItem(item = new BMenuItem("Fit", message = new BMessage(kMsgFontSize))); + subMenu->AddItem(item = new BMenuItem("Fit", + message = new BMessage(kMsgFontSize))); message->AddFloat("font_size", 0.0f); if (fontSize == 0) item->SetMarked(true); @@ -1441,7 +1585,7 @@ void -ProbeView::UpdateSelectionMenuItems(int64 start, int64 end) +ProbeView::_UpdateSelectionMenuItems(int64 start, int64 end) { int64 position = 0; const uint8 *data = fDataView->DataAt(start); @@ -1489,7 +1633,7 @@ void -ProbeView::UpdateBookmarkMenuItems() +ProbeView::_UpdateBookmarkMenuItems() { for (int32 i = 2; i < fBookmarkMenu->CountItems(); i++) { BMenuItem *item = fBookmarkMenu->ItemAt(i); @@ -1514,7 +1658,7 @@ void -ProbeView::AddBookmark(off_t position) +ProbeView::_AddBookmark(off_t position) { int32 count = fBookmarkMenu->CountItems(); @@ -1560,8 +1704,51 @@ void -ProbeView::CheckClipboard() +ProbeView::_RemoveTypeEditor() { + if (fTypeView == NULL) + return; + + if (Parent() != NULL) + Parent()->RemoveChild(fTypeView); + else + Window()->RemoveChild(fTypeView); + + delete fTypeView; + fTypeView = NULL; +} + + +void +ProbeView::_SetTypeEditor(int32 index) +{ + if (index == -1) { + // remove type editor, show raw editor + if (IsHidden()) + Show(); + + _RemoveTypeEditor(); + } else { + // hide raw editor, create and show type editor + if (!IsHidden()) + Hide(); + + _RemoveTypeEditor(); + + fTypeView = new TypeView(Frame(), "type shell", index, fEditor, + B_FOLLOW_ALL); + + if (Parent() != NULL) + Parent()->AddChild(fTypeView); + else + Window()->AddChild(fTypeView); + } +} + + +void +ProbeView::_CheckClipboard() +{ if (!be_clipboard->Lock()) return; @@ -1582,7 +1769,7 @@ status_t -ProbeView::PageSetup() +ProbeView::_PageSetup() { BPrintJob printJob(Window()->Title()); if (fPrintSettings != NULL) @@ -1600,9 +1787,9 @@ void -ProbeView::Print() +ProbeView::_Print() { - if (fPrintSettings == NULL && PageSetup() != B_OK) + if (fPrintSettings == NULL && _PageSetup() != B_OK) return; BPrintJob printJob(Window()->Title()); @@ -1627,7 +1814,7 @@ status_t -ProbeView::Save() +ProbeView::_Save() { status_t status = fEditor.Save(); if (status == B_OK) @@ -1665,7 +1852,7 @@ if (chosen == 1) return false; - return Save() == B_OK; + return _Save() == B_OK; } @@ -1674,7 +1861,7 @@ { switch (message->what) { case B_SAVE_REQUESTED: - Save(); + _Save(); break; case B_OBSERVER_NOTICE_CHANGE: { @@ -1688,7 +1875,7 @@ int64 start, end; if (message->FindInt64("start", &start) == B_OK && message->FindInt64("end", &end) == B_OK) - UpdateSelectionMenuItems(start, end); + _UpdateSelectionMenuItems(start, end); break; } case kDataViewPreferredSize: @@ -1710,9 +1897,9 @@ // The selection menu items depend on the base type as well int32 start, end; fDataView->GetSelection(start, end); - UpdateSelectionMenuItems(start, end); + _UpdateSelectionMenuItems(start, end); - UpdateBookmarkMenuItems(); + _UpdateBookmarkMenuItems(); // update the application's settings BMessage update(*message); @@ -1750,16 +1937,26 @@ break; } + case kMsgViewAs: + { + int32 index; + if (message->FindInt32("editor index", &index) != B_OK) + index = -1; + + _SetTypeEditor(index); + break; + } + case kMsgAddBookmark: - AddBookmark(fHeaderView->Position()); + _AddBookmark(fHeaderView->Position()); break; case kMsgPrint: - Print(); + _Print(); break; case kMsgPageSetup: - PageSetup(); + _PageSetup(); break; case kMsgOpenFindWindow: @@ -1827,7 +2024,7 @@ if (bar != NULL) { BMenuItem *item = bar->FindItem("Attributes"); if (item != NULL && item->Submenu() != NULL) - UpdateAttributesMenu(item->Submenu()); + _UpdateAttributesMenu(item->Submenu()); } } @@ -1844,7 +2041,7 @@ } case B_CLIPBOARD_CHANGED: - CheckClipboard(); + _CheckClipboard(); break; case kMsgDataEditorStateChange: Modified: haiku/trunk/src/apps/diskprobe/ProbeView.h =================================================================== --- haiku/trunk/src/apps/diskprobe/ProbeView.h 2008-01-10 20:54:55 UTC (rev 23351) +++ haiku/trunk/src/apps/diskprobe/ProbeView.h 2008-01-10 21:05:00 UTC (rev 23352) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef PROBE_VIEW_H @@ -24,48 +24,54 @@ class ProbeView : public BView { public: - ProbeView(BRect rect, entry_ref *ref, const char *attribute = NULL, - const BMessage *settings = NULL); + ProbeView(BRect rect, entry_ref* ref, const char* attribute = NULL, + const BMessage* settings = NULL); virtual ~ProbeView(); virtual void DetachedFromWindow(); virtual void AttachedToWindow(); virtual void AllAttached(); virtual void WindowActivated(bool active); - virtual void MessageReceived(BMessage *message); + virtual void MessageReceived(BMessage* message); - void AddSaveMenuItems(BMenu *menu, int32 index); - void AddPrintMenuItems(BMenu *menu, int32 index); + void AddSaveMenuItems(BMenu* menu, int32 index); + void AddPrintMenuItems(BMenu* menu, int32 index); + void AddViewAsMenuItems(); void UpdateSizeLimits(); bool QuitRequested(); - DataEditor &Editor() { return fEditor; } + DataEditor& Editor() { return fEditor; } private: - void UpdateAttributesMenu(BMenu *menu); - void UpdateSelectionMenuItems(int64 start, int64 end); - void UpdateBookmarkMenuItems(); - void AddBookmark(off_t position); - void CheckClipboard(); - status_t PageSetup(); - void Print(); - status_t Save(); + void _UpdateAttributesMenu(BMenu* menu); + void _UpdateSelectionMenuItems(int64 start, int64 end); + void _UpdateBookmarkMenuItems(); + void _AddBookmark(off_t position); + void _RemoveTypeEditor(); + void _SetTypeEditor(int32 index); + void _CheckClipboard(); + status_t _PageSetup(); + void _Print(); + status_t _Save(); DataEditor fEditor; - EditorLooper *fEditorLooper; - HeaderView *fHeaderView; - DataView *fDataView; - BScrollView *fScrollView; [... truncated: 769 lines follow ...] From mmu_man at mail.berlios.de Thu Jan 10 22:08:09 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 22:08:09 +0100 Subject: [Haiku-commits] r23353 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102108.m0AL89ES028830@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 22:08:08 +0100 (Thu, 10 Jan 2008) New Revision: 23353 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23353&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp haiku/trunk/src/system/boot/platform/atari_m68k/Handle.h Log: generic handle class for the console. Added: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp 2008-01-10 21:05:00 UTC (rev 23352) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp 2008-01-10 21:08:08 UTC (rev 23353) @@ -0,0 +1,84 @@ +/* + * Copyright 2003, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include +#include +#include + +#include "Handle.h" +#include "toscalls." + +Handle::Handle(int handle, bool takeOwnership) + : + fHandle((int16)handle), + fOwnHandle(takeOwnership) +{ +} + + +Handle::Handle(void) + : + fHandle(DEV_CONSOLE) +{ +} + + +Handle::~Handle() +{ + //if (fOwnHandle) + // of_close(fHandle); +} + + +void +Handle::SetHandle(int handle, bool takeOwnership) +{ + //if (fHandle && fOwnHandle) + // of_close(fHandle); + + fHandle = (int16)handle; + fOwnHandle = takeOwnership; +} + + +ssize_t +Handle::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) +{ + const char *string = (const char *)buffer; + + // can't seek + for (i = 0; i < bufferSize; i++) { + if (Bconstat(fHandle) == 0) + return i; + Bconin(fHandle, string[i]); + } + + return bufferSize; +} + + +ssize_t +Handle::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) +{ + const char *string = (const char *)buffer; + + // can't seek + for (i = 0; i < bufferSize; i++) { + Bconout(fHandle, string[i]); + } + + return bufferSize; +} + + +off_t +Handle::Size() const +{ + // ToDo: fix this! + return 1024LL * 1024 * 1024 * 1024; + // 1024 GB +} + Added: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Handle.h 2008-01-10 21:05:00 UTC (rev 23352) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Handle.h 2008-01-10 21:08:08 UTC (rev 23353) @@ -0,0 +1,34 @@ +/* + * Copyright 2003, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef HANDLE_H +#define HANDLE_H + + +#include + + +#ifdef __cplusplus + +class Handle : public ConsoleNode { + public: + Handle(int handle, bool takeOwnership = true); + Handle(); + virtual ~Handle(); + + void SetHandle(int handle, bool takeOwnership = true); + + virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize); + virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize); + + virtual off_t Size() const; + + protected: + int16 fHandle; + bool fOwnHandle; +}; + +#endif /* __cplusplus */ + +#endif /* HANDLE_H */ From mmu_man at mail.berlios.de Thu Jan 10 22:15:47 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 22:15:47 +0100 Subject: [Haiku-commits] r23354 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102115.m0ALFlau029689@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 22:15:46 +0100 (Thu, 10 Jan 2008) New Revision: 23354 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23354&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp Log: * Note for stage1 * Fix call to Bconin() add correct color handling. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp 2008-01-10 21:08:08 UTC (rev 23353) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp 2008-01-10 21:15:46 UTC (rev 23354) @@ -53,7 +53,7 @@ for (i = 0; i < bufferSize; i++) { if (Bconstat(fHandle) == 0) return i; - Bconin(fHandle, string[i]); + string[i] = (char)Bconin(fHandle); } return bufferSize; Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-10 21:08:08 UTC (rev 23353) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-10 21:15:46 UTC (rev 23354) @@ -52,3 +52,5 @@ # Tell the build system to where stage1.bin can be found, so it can be used # elsewhere. SEARCH on stage1.bin = $(SUBDIR) ; + +# cf pxe_ia32 Jamfile for stage1 Modified: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 21:08:08 UTC (rev 23353) +++ haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 21:15:46 UTC (rev 23354) @@ -241,13 +241,10 @@ void console_set_color(int32 foreground, int32 background) { - // Note: Toggling the cursor doesn't seem to help. We still get cursor - // artifacts. - of_interpret("toggle-cursor" - " to foreground-color" - " to background-color" - " toggle-cursor", - 2, 0, translate_color(foreground), translate_color(background)); + char buff[] = "\033b \033c "; + buff[2] = (char)translate_color(foreground); + buff[5] = (char)translate_color(background); + stdin->WriteAt(NULL, 0LL, buff, 6); } From mmu_man at mail.berlios.de Thu Jan 10 22:16:22 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 22:16:22 +0100 Subject: [Haiku-commits] r23355 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102116.m0ALGMb5029752@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 22:16:22 +0100 (Thu, 10 Jan 2008) New Revision: 23355 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23355&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp Log: Handle console input. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 21:15:46 UTC (rev 23354) +++ haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 21:16:22 UTC (rev 23355) @@ -251,6 +251,8 @@ int console_wait_for_key(void) { +#if 0 + // XXX: do this way and remove keyboard.cpp ? // wait for a key char buffer[3]; ssize_t bytesRead; @@ -259,34 +261,27 @@ if (bytesRead < 0) return 0; } while (bytesRead == 0); +#endif + union key key = wait_for_key(); - // translate the ESC sequences for cursor keys - if (bytesRead == 3 && buffer[0] == 27 && buffer [1] == 91) { - switch (buffer[2]) { - case 65: + if (key.code.ascii == 0) { + switch (key.code.bios) { + case BIOS_KEY_UP: return TEXT_CONSOLE_KEY_UP; - case 66: + case BIOS_KEY_DOWN: return TEXT_CONSOLE_KEY_DOWN; - case 67: - return TEXT_CONSOLE_KEY_RIGHT; - case 68: - return TEXT_CONSOLE_KEY_LEFT; -// TODO: Translate the codes for the following keys. Unfortunately my OF just -// returns a '\0' character. :-/ -// TEXT_CONSOLE_KEY_PAGE_UP, -// TEXT_CONSOLE_KEY_PAGE_DOWN, -// TEXT_CONSOLE_KEY_HOME, -// TEXT_CONSOLE_KEY_END, - + case BIOS_KEY_PAGE_UP: + return TEXT_CONSOLE_KEY_PAGE_UP; + case BIOS_KEY_PAGE_DOWN: + return TEXT_CONSOLE_KEY_PAGE_DOWN; + case BIOS_KEY_HOME: + return TEXT_CONSOLE_KEY_HOME; + case BIOS_KEY_END: + return TEXT_CONSOLE_KEY_END; default: - break; + return 0; } - } - - // put back unread chars - if (bytesRead > 1) - sInput.PutChars(buffer + 1, bytesRead - 1); - - return buffer[0]; + } else + return key.code.ascii; } From axeld at mail.berlios.de Thu Jan 10 22:26:56 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 10 Jan 2008 22:26:56 +0100 Subject: [Haiku-commits] r23356 - in haiku/trunk/src: kits/interface servers/app Message-ID: <200801102126.m0ALQumJ030413@sheep.berlios.de> Author: axeld Date: 2008-01-10 22:26:55 +0100 (Thu, 10 Jan 2008) New Revision: 23356 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23356&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp haiku/trunk/src/servers/app/Desktop.cpp Log: * The keyboard target was always the first menu in the window list - no matter if that was hidden or not. This fixes the bug described by Stefano in r23343. * Therefore, I enabled cached menu windows again. Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-10 21:16:22 UTC (rev 23355) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-10 21:26:55 UTC (rev 23356) @@ -34,7 +34,7 @@ #include "utf8_functions.h" -#define USE_CACHED_MENUWINDOW 0 +#define USE_CACHED_MENUWINDOW 1 using std::nothrow; using BPrivate::BMenuWindow; Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2008-01-10 21:16:22 UTC (rev 23355) +++ haiku/trunk/src/servers/app/Desktop.cpp 2008-01-10 21:26:55 UTC (rev 23356) @@ -1172,6 +1172,9 @@ Desktop::KeyboardEventTarget() { WindowLayer* window = _CurrentWindows().LastWindow(); + while (window != NULL && window->IsHidden()) { + window = window->PreviousWindow(fCurrentWorkspace); + } if (window != NULL && window->Feel() == kMenuWindowFeel) return &window->EventTarget(); From mmu_man at mail.berlios.de Thu Jan 10 22:27:33 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 22:27:33 +0100 Subject: [Haiku-commits] r23357 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102127.m0ALRXFa030466@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 22:27:33 +0100 (Thu, 10 Jan 2008) New Revision: 23357 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23357&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp Log: Missing include. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 21:26:55 UTC (rev 23356) +++ haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 21:27:33 UTC (rev 23357) @@ -13,6 +13,7 @@ #include "Handle.h" #include "console.h" +#include "keyboard.h" // TOS emulates a VT52 From axeld at pinc-software.de Thu Jan 10 22:28:57 2008 From: axeld at pinc-software.de (=?iso-8859-1?q?=41=78=65=6c=20=44=f6=72=66=6c=65=72?=) Date: Thu, 10 Jan 2008 22:28:57 +0100 (MET) Subject: [Haiku-commits] r23343 - haiku/trunk/src/kits/interface Message-ID: <200801102128.m0ALSvSO012674@post.webmailer.de> From: Stefano Ceccherini > > IsModal() now includes also the kMenuWindowLook. Fixes bug #1269. Please > > review. Looks good to me. > This would mean there's some bug in the focus mechanism in the > app_server, wouldn't it ? > Axel, since you wrote that part, do you have any idea ? After having looked at the method in question (Desktop::KeyboardEventTarget()), I had an idea, indeed :-) It's fixed in r23356. Bye, Axel. From mmu_man at mail.berlios.de Thu Jan 10 22:30:31 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 22:30:31 +0100 Subject: [Haiku-commits] r23358 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102130.m0ALUVhC030803@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 22:30:31 +0100 (Thu, 10 Jan 2008) New Revision: 23358 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23358&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp Log: Fixes. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 21:27:33 UTC (rev 23357) +++ haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 21:30:31 UTC (rev 23358) @@ -26,7 +26,6 @@ size_t bufferSize); virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize); - int16 f }; class InputConsoleHandle : public ConsoleHandle { @@ -75,6 +74,7 @@ size_t bufferSize) { const char *string = (const char *)buffer; + int i; // be nice to our audience and replace single "\n" with "\r\n" From mmu_man at mail.berlios.de Thu Jan 10 22:41:55 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 22:41:55 +0100 Subject: [Haiku-commits] r23359 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102141.m0ALftn9031464@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 22:41:55 +0100 (Thu, 10 Jan 2008) New Revision: 23359 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23359&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp Log: shouldn't access FILE as it's not declared. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 21:30:31 UTC (rev 23358) +++ haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 21:41:55 UTC (rev 23359) @@ -181,7 +181,7 @@ void console_clear_screen(void) { - stdin->WriteAt(NULL, 0LL, "\033E", 2); + sInput.WriteAt(NULL, 0LL, "\033E", 2); } @@ -207,7 +207,7 @@ char buff[] = "\033Y "; buff[3] += (char)x; buff[2] += (char)y; - stdin->WriteAt(NULL, 0LL, buff, 4); + sInput.WriteAt(NULL, 0LL, buff, 4); } @@ -245,7 +245,7 @@ char buff[] = "\033b \033c "; buff[2] = (char)translate_color(foreground); buff[5] = (char)translate_color(background); - stdin->WriteAt(NULL, 0LL, buff, 6); + sInput.WriteAt(NULL, 0LL, buff, 6); } From mmu_man at mail.berlios.de Thu Jan 10 22:43:42 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 22:43:42 +0100 Subject: [Haiku-commits] r23360 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102143.m0ALhgjV031566@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 22:43:42 +0100 (Thu, 10 Jan 2008) New Revision: 23360 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23360&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp Log: Fix warning. helf: if you are bored you can just help coding :P Modified: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 21:41:55 UTC (rev 23359) +++ haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 21:43:42 UTC (rev 23360) @@ -74,7 +74,7 @@ size_t bufferSize) { const char *string = (const char *)buffer; - int i; + size_t i; // be nice to our audience and replace single "\n" with "\r\n" From mmu_man at mail.berlios.de Thu Jan 10 23:02:03 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 23:02:03 +0100 Subject: [Haiku-commits] r23361 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102202.m0AM2369000085@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 23:02:03 +0100 (Thu, 10 Jan 2008) New Revision: 23361 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23361&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/debug.c haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: Fix debug output code. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/debug.c =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/debug.c 2008-01-10 21:43:42 UTC (rev 23360) +++ haiku/trunk/src/system/boot/platform/atari_m68k/debug.c 2008-01-10 22:02:03 UTC (rev 23361) @@ -4,7 +4,6 @@ */ -#include "serial.h" #include "keyboard.h" #include "toscalls.h" @@ -19,18 +18,22 @@ void panic(const char *format, ...) { + char buffer[512]; va_list list; + int length; - platform_switch_to_text_mode(); + //platform_switch_to_text_mode(); - puts("*** PANIC ***"); + Bconputs(DEV_CONSOLE, "*** PANIC ***"); va_start(list, format); - vprintf(format, list); + length = vsnprintf(buffer, sizeof(buffer), format, list); va_end(list); - puts("\nPress key to reboot."); + Bconputs(DEV_CONSOLE, buffer); + Bconputs(DEV_CONSOLE, "\nPress key to reboot."); + clear_key_buffer(); wait_for_key(); platform_exit(); @@ -48,10 +51,10 @@ length = vsnprintf(buffer, sizeof(buffer), format, list); va_end(list); - serial_puts(buffer, length); + Bconputs(DEV_AUX, buffer); if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) - fprintf(stderr, "%s", buffer); + Bconputs(DEV_CONSOLE, buffer); } Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-10 21:43:42 UTC (rev 23360) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-10 22:02:03 UTC (rev 23361) @@ -71,6 +71,18 @@ #define Drvmap() (uint32)bios(10) #define Kbshift(mode) bios(11, (uint16)mode) +/* handy shortcut */ +static inline int Bconputs(int16 handle, const char *string) +{ + int i, err; + for (i = 0; string[i]; i++) { + err = Bconout(string[i]); + if (err) + return i; + } + return i; +} + /* * Atari XBIOS calls */ From mmu_man at mail.berlios.de Thu Jan 10 23:08:12 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 23:08:12 +0100 Subject: [Haiku-commits] r23362 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102208.m0AM8CLr000528@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 23:08:12 +0100 (Thu, 10 Jan 2008) New Revision: 23362 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23362&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: hey it's only 23:00! Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-10 22:02:03 UTC (rev 23361) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-10 22:08:12 UTC (rev 23362) @@ -76,7 +76,7 @@ { int i, err; for (i = 0; string[i]; i++) { - err = Bconout(string[i]); + err = Bconout(handle, string[i]); if (err) return i; } From mmu_man at mail.berlios.de Thu Jan 10 23:16:41 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 23:16:41 +0100 Subject: [Haiku-commits] r23363 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102216.m0AMGfNZ001472@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 23:16:40 +0100 (Thu, 10 Jan 2008) New Revision: 23363 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23363&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/video.cpp haiku/trunk/src/system/boot/platform/atari_m68k/video.h Log: Video mode menu and support stubs. Added: haiku/trunk/src/system/boot/platform/atari_m68k/video.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/video.cpp 2008-01-10 22:08:12 UTC (rev 23362) +++ haiku/trunk/src/system/boot/platform/atari_m68k/video.cpp 2008-01-10 22:16:40 UTC (rev 23363) @@ -0,0 +1,135 @@ +/* + * Copyright 2004-2007, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include "video.h" +//#include "mmu.h" +#include "images.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +//#define TRACE_VIDEO +#ifdef TRACE_VIDEO +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + + +// XXX: use falcon video monitor detection and build possible mode list there... + + +// #pragma mark - + + +bool +video_mode_hook(Menu *menu, MenuItem *item) +{ + // nothing yet +#if 0 + // find selected mode + video_mode *mode = NULL; + + menu = item->Submenu(); + item = menu->FindMarked(); + if (item != NULL) { + switch (menu->IndexOf(item)) { + case 0: + // "Default" mode special + sMode = sDefaultMode; + sModeChosen = false; + return true; + case 1: + // "Standard VGA" mode special + // sets sMode to NULL which triggers VGA mode + break; + default: + mode = (video_mode *)item->Data(); + break; + } + } + + if (mode != sMode) { + // update standard mode + // ToDo: update fb settings! + sMode = mode; + } + + sModeChosen = true; +#endif + return true; +} + + +Menu * +video_mode_menu() +{ + Menu *menu = new(nothrow) Menu(CHOICE_MENU, "Select Video Mode"); + MenuItem *item; + + menu->AddItem(item = new(nothrow) MenuItem("Default")); + item->SetMarked(true); + item->Select(true); + item->SetHelpText("The Default video mode is the one currently configured " + "in the system. If there is no mode configured yet, a viable mode will " + "be chosen automatically."); + +#if 0 + menu->AddItem(new(nothrow) MenuItem("Standard VGA")); + + video_mode *mode = NULL; + while ((mode = (video_mode *)list_get_next_item(&sModeList, mode)) != NULL) { + char label[64]; + sprintf(label, "%ux%u %u bit", mode->width, mode->height, + mode->bits_per_pixel); + + menu->AddItem(item = new(nothrow) MenuItem(label)); + item->SetData(mode); + } +#endif + + menu->AddSeparatorItem(); + menu->AddItem(item = new(nothrow) MenuItem("Return to main menu")); + item->SetType(MENU_ITEM_NO_CHOICE); + + return menu; +} + + +// #pragma mark - + + +extern "C" void +platform_switch_to_logo(void) +{ + // ToDo: implement me +} + + +extern "C" void +platform_switch_to_text_mode(void) +{ + // ToDo: implement me +} + + +extern "C" status_t +platform_init_video(void) +{ + // ToDo: implement me + return B_OK; +} + Added: haiku/trunk/src/system/boot/platform/atari_m68k/video.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/video.h 2008-01-10 22:08:12 UTC (rev 23362) +++ haiku/trunk/src/system/boot/platform/atari_m68k/video.h 2008-01-10 22:16:40 UTC (rev 23363) @@ -0,0 +1,18 @@ +/* +** Copyright 2004, Axel D?rfler, axeld at pinc-software.de. All rights reserved. +** Distributed under the terms of the Haiku License. +*/ +#ifndef VIDEO_H +#define VIDEO_H + + +#include + + +class Menu; +class MenuItem; + +bool video_mode_hook(Menu *menu, MenuItem *item); +Menu *video_mode_menu(); + +#endif /* VIDEO_H */ From mmu_man at mail.berlios.de Thu Jan 10 23:18:38 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 23:18:38 +0100 Subject: [Haiku-commits] r23364 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102218.m0AMIcvm001625@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 23:18:38 +0100 (Thu, 10 Jan 2008) New Revision: 23364 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23364&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/video.cpp Log: No images yet. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/video.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/video.cpp 2008-01-10 22:16:40 UTC (rev 23363) +++ haiku/trunk/src/system/boot/platform/atari_m68k/video.cpp 2008-01-10 22:18:38 UTC (rev 23364) @@ -6,7 +6,7 @@ #include "video.h" //#include "mmu.h" -#include "images.h" +//#include "images.h" #include #include From mmu_man at mail.berlios.de Thu Jan 10 23:25:10 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Jan 2008 23:25:10 +0100 Subject: [Haiku-commits] r23365 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102225.m0AMPAYr002641@sheep.berlios.de> Author: mmu_man Date: 2008-01-10 23:25:10 +0100 (Thu, 10 Jan 2008) New Revision: 23365 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23365&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile Log: * Comment unneeded files. * I *do* want PIC code for m68k! Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-10 22:18:38 UTC (rev 23364) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-10 22:25:10 UTC (rev 23365) @@ -22,19 +22,19 @@ shell.S start.c debug.c - bios.S + #bios.S console.cpp - serial.cpp + #serial.cpp devices.cpp keyboard.cpp menu.cpp mmu.cpp cpu.cpp - smp.cpp - smp_trampoline.S + #smp.cpp + #smp_trampoline.S support.S video.cpp - apm.cpp + #apm.cpp # generic text_menu.cpp @@ -43,7 +43,7 @@ #decode_edid.c #dump_edid.c - : -fno-pic + : -fpic -Wa,--pcrel ; SEARCH on [ FGristFiles text_menu.cpp ] From mmu_man at mail.berlios.de Fri Jan 11 00:16:55 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 00:16:55 +0100 Subject: [Haiku-commits] r23366 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102316.m0ANGtJF006551@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 00:16:55 +0100 (Fri, 11 Jan 2008) New Revision: 23366 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23366&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp haiku/trunk/src/system/boot/platform/atari_m68k/Handle.h haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp Log: * Get rid of owner, BIOS devices don't need open/close. * split Handle class to CharHandle and BlockHandle. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp 2008-01-10 22:25:10 UTC (rev 23365) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp 2008-01-10 23:16:55 UTC (rev 23366) @@ -11,10 +11,20 @@ #include "Handle.h" #include "toscalls." -Handle::Handle(int handle, bool takeOwnership) +/* + * (X)BIOS supports char and block devices with a separate namespace + * for char devs handle is {DEV_PRINTER, ... DEV_CONSOLE, ...} + * for block devs handle is the drive number. + * BlockHandle is in devices.cpp + * + * XXX: handle network devices ? not sure how TOS net extensions do this + * not sure it'll ever be supported anyway. + * XXX: BIOSDrive/BIOSHandle : public BlockHandle ? + */ + +Handle::Handle(int handle) : fHandle((int16)handle), - fOwnHandle(takeOwnership) { } @@ -28,25 +38,62 @@ Handle::~Handle() { - //if (fOwnHandle) - // of_close(fHandle); } void -Handle::SetHandle(int handle, bool takeOwnership) +Handle::SetHandle(int handle) { - //if (fHandle && fOwnHandle) - // of_close(fHandle); - fHandle = (int16)handle; - fOwnHandle = takeOwnership; } ssize_t Handle::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) { + return B_ERROR; +} + + +ssize_t +Handle::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) +{ + return B_ERROR; +} + + +off_t +Handle::Size() const +{ + // ToDo: fix this! + return 1024LL * 1024 * 1024 * 1024; + // 1024 GB +} + + +// #pragma mark - + + +CharHandle::CharHandle(int handle) + : Handle(handle) +{ +} + + +CharHandle::CharHandle(void) + : Handle() +{ +} + + +CharHandle::~CharHandle() +{ +} + + +ssize_t +CharHandle::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) +{ const char *string = (const char *)buffer; // can't seek @@ -61,11 +108,13 @@ ssize_t -Handle::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) +CharHandle::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) { const char *string = (const char *)buffer; // can't seek + + //XXX: check Bcostat ? for (i = 0; i < bufferSize; i++) { Bconout(fHandle, string[i]); } @@ -75,10 +124,81 @@ off_t -Handle::Size() const +CharHandle::Size() const { // ToDo: fix this! return 1024LL * 1024 * 1024 * 1024; // 1024 GB } + +// #pragma mark - + + +BlockHandle::BlockHandle(int handle) + : Handle(handle) +{ +} + + +BlockHandle::BlockHandle(void) + : Handle() +{ +} + + +BlockHandle::~BlockHandle() +{ +} + + +status_t +BlockHandle::InitCheck() const +{ + uint32 map = Drvmap(); + if (!(map & (1 << fHandle))) + return ENODEV; + //XXX: check size + return B_OK; +} + + +ssize_t +BlockHandle::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) +{ + const char *string = (const char *)buffer; + + // can't seek + for (i = 0; i < bufferSize; i++) { + if (Bconstat(fHandle) == 0) + return i; + string[i] = (char)Bconin(fHandle); + } + + return bufferSize; +} + + +ssize_t +BlockHandle::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) +{ + const char *string = (const char *)buffer; + + // can't seek + for (i = 0; i < bufferSize; i++) { + Bconout(fHandle, string[i]); + } + + return bufferSize; +} + + +off_t +BlockHandle::Size() const +{ + // ToDo: fix this! + return 1024LL * 1024 * 1024 * 1024; + // 1024 GB +} + + Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Handle.h 2008-01-10 22:25:10 UTC (rev 23365) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Handle.h 2008-01-10 23:16:55 UTC (rev 23366) @@ -13,11 +13,11 @@ class Handle : public ConsoleNode { public: - Handle(int handle, bool takeOwnership = true); + Handle(int handle); Handle(); virtual ~Handle(); - void SetHandle(int handle, bool takeOwnership = true); + void SetHandle(int handle); virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize); virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize); @@ -26,9 +26,24 @@ protected: int16 fHandle; - bool fOwnHandle; }; +/* character devices */ +class CharHandle : public Handle { + public: + CharHandle(int handle); + CharHandle(); + virtual ~CharHandle(); + + virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize); + virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize); + + protected: +}; + +/* block devices */ +/* cf. devices.cpp */ + #endif /* __cplusplus */ #endif /* HANDLE_H */ Modified: haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 22:25:10 UTC (rev 23365) +++ haiku/trunk/src/system/boot/platform/atari_m68k/console.cpp 2008-01-10 23:16:55 UTC (rev 23366) @@ -18,7 +18,7 @@ // TOS emulates a VT52 -class ConsoleHandle : public Handle { +class ConsoleHandle : public CharHandle { public: ConsoleHandle(); @@ -54,7 +54,7 @@ ConsoleHandle::ConsoleHandle() - : Handle() + : CharHandle() { } From mmu_man at mail.berlios.de Fri Jan 11 00:26:04 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 00:26:04 +0100 Subject: [Haiku-commits] r23367 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801102326.m0ANQ42n007219@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 00:26:04 +0100 (Fri, 11 Jan 2008) New Revision: 23367 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23367&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp Log: BlockHandle goes to devices.cpp Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp 2008-01-10 23:16:55 UTC (rev 23366) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp 2008-01-10 23:26:04 UTC (rev 23367) @@ -131,74 +131,3 @@ // 1024 GB } - -// #pragma mark - - - -BlockHandle::BlockHandle(int handle) - : Handle(handle) -{ -} - - -BlockHandle::BlockHandle(void) - : Handle() -{ -} - - -BlockHandle::~BlockHandle() -{ -} - - -status_t -BlockHandle::InitCheck() const -{ - uint32 map = Drvmap(); - if (!(map & (1 << fHandle))) - return ENODEV; - //XXX: check size - return B_OK; -} - - -ssize_t -BlockHandle::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) -{ - const char *string = (const char *)buffer; - - // can't seek - for (i = 0; i < bufferSize; i++) { - if (Bconstat(fHandle) == 0) - return i; - string[i] = (char)Bconin(fHandle); - } - - return bufferSize; -} - - -ssize_t -BlockHandle::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) -{ - const char *string = (const char *)buffer; - - // can't seek - for (i = 0; i < bufferSize; i++) { - Bconout(fHandle, string[i]); - } - - return bufferSize; -} - - -off_t -BlockHandle::Size() const -{ - // ToDo: fix this! - return 1024LL * 1024 * 1024 * 1024; - // 1024 GB -} - - From mmu_man at mail.berlios.de Fri Jan 11 01:21:48 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 01:21:48 +0100 Subject: [Haiku-commits] r23368 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801110021.m0B0Lm3V029857@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 01:21:48 +0100 (Fri, 11 Jan 2008) New Revision: 23368 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23368&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp Log: comments on bios drives. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp 2008-01-10 23:26:04 UTC (rev 23367) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp 2008-01-11 00:21:48 UTC (rev 23368) @@ -14,7 +14,10 @@ /* * (X)BIOS supports char and block devices with a separate namespace * for char devs handle is {DEV_PRINTER, ... DEV_CONSOLE, ...} - * for block devs handle is the drive number. + * for block devs handle is either: + * - the partition number {0=A:, 2=C:...} in logical mode. + * - the drive number {0=A:, 1=B:, 2=ACSI-0, 10=SCSI-0, ...} + * in phys mode (RW_NOTRANSLATE). * BlockHandle is in devices.cpp * * XXX: handle network devices ? not sure how TOS net extensions do this From mmu_man at mail.berlios.de Fri Jan 11 01:22:10 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 01:22:10 +0100 Subject: [Haiku-commits] r23369 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801110022.m0B0MAPl029966@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 01:22:09 +0100 (Fri, 11 Jan 2008) New Revision: 23369 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23369&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp Log: Start of BIOS drive support. Hmmm how will I get the size of physical drives ??? Added: haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp 2008-01-11 00:21:48 UTC (rev 23368) +++ haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp 2008-01-11 00:22:09 UTC (rev 23369) @@ -0,0 +1,750 @@ +/* + * Copyright 2003-2006, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include "toscalls.h" + +#include +#include +#include +#include +#include + +#include + +//#define TRACE_DEVICES +#ifdef TRACE_DEVICES +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + + +// exported from shell.S +extern uint8 gBootedFromImage; +extern uint8 gBootDriveID; +extern uint32 gBootPartitionOffset; + +#define SCRATCH_SIZE (2*4096) +static uint8 gScratchBuffer[4096]; + +static const uint16 kParametersSizeVersion1 = 0x1a; +static const uint16 kParametersSizeVersion2 = 0x1e; +static const uint16 kParametersSizeVersion3 = 0x42; + +static const uint16 kDevicePathSignature = 0xbedd; + +struct drive_parameters { + uint16 parameters_size; + uint16 flags; + uint32 cylinders; + uint32 heads; + uint32 sectors_per_track; + uint64 sectors; + uint16 bytes_per_sector; + /* edd 2.0 */ + real_addr device_table; + /* edd 3.0 */ + uint16 device_path_signature; + uint8 device_path_size; + uint8 reserved1[3]; + char host_bus[4]; + char interface_type[8]; + union { + struct { + uint16 base_address; + } legacy; + struct { + uint8 bus; + uint8 slot; + uint8 function; + } pci; + uint8 reserved[8]; + } interface; + union { + struct { + uint8 slave; + } ata; + struct { + uint8 slave; + uint8 logical_unit; + } atapi; + struct { + uint8 logical_unit; + } scsi; + struct { + uint8 tbd; + } usb; + struct { + uint64 guid; + } firewire; + struct { + uint64 wwd; + } fibre; + } device; + uint8 reserved2; + uint8 checksum; +} _PACKED; + +struct device_table { + uint16 base_address; + uint16 control_port_address; + uint8 _reserved1 : 4; + uint8 is_slave : 1; + uint8 _reserved2 : 1; + uint8 lba_enabled : 1; +} _PACKED; + +struct specification_packet { + uint8 size; + uint8 media_type; + uint8 drive_number; + uint8 controller_index; + uint32 start_emulation; + uint16 device_specification; + uint8 _more_[9]; +} _PACKED; + +class BlockHandle : public Handle { + public: + BlockHandle(int handle); + virtual ~BlockHandle(); + + status_t InitCheck() const; + + virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize); + virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize); + + virtual off_t Size() const; + + uint32 BlockSize() const { return fBlockSize; } + + status_t FillIdentifier(); + + bool HasParameters() const { return fHasParameters; } + const drive_parameters &Parameters() const { return fParameters; } + + disk_identifier &Identifier() { return fIdentifier; } + uint8 DriveID() const { return fHandle; } + + protected: + bool fLBA; + uint64 fSize; + uint32 fBlockSize; + bool fHasParameters; + drive_parameters fParameters; + disk_identifier fIdentifier; +}; + + +static bool sBlockDevicesAdded = false; + + +static void +check_cd_boot(BlockHandle *drive) +{ + gKernelArgs.boot_volume.SetInt32(BOOT_METHOD, BOOT_METHOD_HARD_DISK); + + if (drive->DriveID() != 0) + return; + + struct bios_regs regs; + regs.eax = BIOS_BOOT_CD_GET_STATUS; + regs.edx = 0; + regs.esi = kDataSegmentScratch; + call_bios(0x13, ®s); + + if ((regs.flags & CARRY_FLAG) != 0) + return; + + // we obviously were booted from CD! + + specification_packet *packet = (specification_packet *)kDataSegmentScratch; + if (packet->media_type != 0) + gKernelArgs.boot_volume.SetInt32(BOOT_METHOD, BOOT_METHOD_CD); + +#if 0 + dprintf("got CD boot spec:\n"); + dprintf(" size: %#x\n", packet->size); + dprintf(" media type: %u\n", packet->media_type); + dprintf(" drive_number: %u\n", packet->drive_number); + dprintf(" controller index: %u\n", packet->controller_index); + dprintf(" start emulation: %lu\n", packet->start_emulation); + dprintf(" device_specification: %u\n", packet->device_specification); +#endif +} + + +static status_t +get_ext_drive_parameters(uint8 drive, drive_parameters *targetParameters) +{ + drive_parameters *parameter = (drive_parameters *)kDataSegmentScratch; + + memset(parameter, 0, sizeof(drive_parameters)); + parameter->parameters_size = sizeof(drive_parameters); + + struct bios_regs regs; + regs.eax = BIOS_GET_EXT_DRIVE_PARAMETERS; + regs.edx = drive; + regs.esi = (addr_t)parameter - kDataSegmentBase; + call_bios(0x13, ®s); + + // filter out faulty BIOS return codes + if ((regs.flags & CARRY_FLAG) != 0 + || parameter->sectors == 0) + return B_ERROR; + + memcpy(targetParameters, parameter, sizeof(drive_parameters)); + return B_OK; +} + + +static status_t +get_drive_parameters(uint8 drive, drive_parameters *parameters) +{ + struct bios_regs regs; + regs.eax = BIOS_GET_DRIVE_PARAMETERS; + regs.edx = drive; + regs.es = 0; + regs.edi = 0; // guard against faulty BIOS, see Ralf Brown's interrupt list + call_bios(0x13, ®s); + + if ((regs.flags & CARRY_FLAG) != 0 || (regs.ecx & 0x3f) == 0) + return B_ERROR; + + // fill drive_parameters structure with useful values + parameters->parameters_size = kParametersSizeVersion1; + parameters->flags = 0; + parameters->cylinders = (((regs.ecx & 0xc0) << 2) | ((regs.ecx >> 8) & 0xff)) + 1; + parameters->heads = ((regs.edx >> 8) & 0xff) + 1; + // heads and cylinders start counting from 0 + parameters->sectors_per_track = regs.ecx & 0x3f; + parameters->sectors = parameters->cylinders * parameters->heads + * parameters->sectors_per_track; + parameters->bytes_per_sector = 512; + + return B_OK; +} + + +static status_t +get_number_of_drives(uint8 *_count) +{ + struct bios_regs regs; + regs.eax = BIOS_GET_DRIVE_PARAMETERS; + regs.edx = 0x80; + regs.es = 0; + regs.edi = 0; + call_bios(0x13, ®s); + + if (regs.flags & CARRY_FLAG) + return B_ERROR; + + *_count = regs.edx & 0xff; + return B_OK; +} + + +/** parse EDD 3.0 drive path information */ + +static status_t +fill_disk_identifier_v3(disk_identifier &disk, const drive_parameters ¶meters) +{ + if (parameters.parameters_size < kParametersSizeVersion3 + || parameters.device_path_signature != kDevicePathSignature) + return B_BAD_TYPE; + + // parse host bus + + if (!strncmp(parameters.host_bus, "PCI", 3)) { + disk.bus_type = PCI_BUS; + + disk.bus.pci.bus = parameters.interface.pci.bus; + disk.bus.pci.slot = parameters.interface.pci.slot; + disk.bus.pci.function = parameters.interface.pci.function; + } else if (!strncmp(parameters.host_bus, "ISA", 3)) { + disk.bus_type = LEGACY_BUS; + + disk.bus.legacy.base_address = parameters.interface.legacy.base_address; + dprintf("legacy base address %x\n", disk.bus.legacy.base_address); + } else { + dprintf("unknown host bus \"%s\"\n", parameters.host_bus); + return B_BAD_DATA; + } + + // parse interface + + if (!strncmp(parameters.interface_type, "ATA", 3)) { + disk.device_type = ATA_DEVICE; + disk.device.ata.master = !parameters.device.ata.slave; + dprintf("ATA device, %s\n", disk.device.ata.master ? "master" : "slave"); + } else if (!strncmp(parameters.interface_type, "ATAPI", 3)) { + disk.device_type = ATAPI_DEVICE; + disk.device.atapi.master = !parameters.device.ata.slave; + disk.device.atapi.logical_unit = parameters.device.atapi.logical_unit; + } else if (!strncmp(parameters.interface_type, "SCSI", 3)) { + disk.device_type = SCSI_DEVICE; + disk.device.scsi.logical_unit = parameters.device.scsi.logical_unit; + } else if (!strncmp(parameters.interface_type, "USB", 3)) { + disk.device_type = USB_DEVICE; + disk.device.usb.tbd = parameters.device.usb.tbd; + } else if (!strncmp(parameters.interface_type, "1394", 3)) { + disk.device_type = FIREWIRE_DEVICE; + disk.device.firewire.guid = parameters.device.firewire.guid; + } else if (!strncmp(parameters.interface_type, "FIBRE", 3)) { + disk.device_type = FIBRE_DEVICE; + disk.device.fibre.wwd = parameters.device.fibre.wwd; + } else { + dprintf("unknown interface type \"%s\"\n", parameters.interface_type); + return B_BAD_DATA; + } + + return B_OK; +} + + +/** EDD 2.0 drive table information */ + +static status_t +fill_disk_identifier_v2(disk_identifier &disk, const drive_parameters ¶meters) +{ + if (parameters.device_table.segment == 0xffff + && parameters.device_table.offset == 0xffff) + return B_BAD_TYPE; + + device_table *table = (device_table *)LINEAR_ADDRESS(parameters.device_table.segment, + parameters.device_table.offset); + + disk.bus_type = LEGACY_BUS; + disk.bus.legacy.base_address = table->base_address; + + disk.device_type = ATA_DEVICE; + disk.device.ata.master = !table->is_slave; + + return B_OK; +} + + +static off_t +get_next_check_sum_offset(int32 index, off_t maxSize) +{ + // The boot block often contains the disk super block, and should be + // unique enough for most cases + if (index < 2) + return index * 512; + + // Try some data in the first part of the drive + if (index < 4) + return (maxSize >> 10) + index * 2048; + + // Some random value might do + return ((system_time() + index) % (maxSize >> 9)) * 512; +} + + +/** Computes a check sum for the specified block. + * The check sum is the sum of all data in that block interpreted as an + * array of uint32 values. + * Note, this must use the same method as the one used in kernel/fs/vfs_boot.cpp. + */ + +static uint32 +compute_check_sum(BlockHandle *drive, off_t offset) +{ + char buffer[512]; + ssize_t bytesRead = drive->ReadAt(NULL, offset, buffer, sizeof(buffer)); + if (bytesRead < B_OK) + return 0; + + if (bytesRead < (ssize_t)sizeof(buffer)) + memset(buffer + bytesRead, 0, sizeof(buffer) - bytesRead); + + uint32 *array = (uint32 *)buffer; + uint32 sum = 0; + + for (uint32 i = 0; i < (bytesRead + sizeof(uint32) - 1) / sizeof(uint32); i++) { + sum += array[i]; + } + + return sum; +} + + +static void +find_unique_check_sums(NodeList *devices) +{ + NodeIterator iterator = devices->GetIterator(); + Node *device; + int32 index = 0; + off_t minSize = 0; + const int32 kMaxTries = 200; + + while (index < kMaxTries) { + bool clash = false; + + iterator.Rewind(); + + while ((device = iterator.Next()) != NULL) { + BlockHandle *drive = (BlockHandle *)device; +#if 0 + // there is no RTTI in the boot loader... + BlockHandle *drive = dynamic_cast(device); + if (drive == NULL) + continue; +#endif + + // TODO: currently, we assume that the BIOS provided us with unique + // disk identifiers... hopefully this is a good idea + if (drive->Identifier().device_type != UNKNOWN_DEVICE) + continue; + + if (minSize == 0 || drive->Size() < minSize) + minSize = drive->Size(); + + // check for clashes + + NodeIterator compareIterator = devices->GetIterator(); + while ((device = compareIterator.Next()) != NULL) { + BlockHandle *compareDrive = (BlockHandle *)device; + + if (compareDrive == drive + || compareDrive->Identifier().device_type != UNKNOWN_DEVICE) + continue; + + if (!memcmp(&drive->Identifier(), &compareDrive->Identifier(), + sizeof(disk_identifier))) { + clash = true; + break; + } + } + + if (clash) + break; + } + + if (!clash) { + // our work here is done. + return; + } + + // add a new block to the check sums + + off_t offset = get_next_check_sum_offset(index, minSize); + int32 i = index % NUM_DISK_CHECK_SUMS; + iterator.Rewind(); + + while ((device = iterator.Next()) != NULL) { + BlockHandle *drive = (BlockHandle *)device; + + disk_identifier& disk = drive->Identifier(); + disk.device.unknown.check_sums[i].offset = offset; + disk.device.unknown.check_sums[i].sum = compute_check_sum(drive, offset); + + TRACE(("disk %x, offset %Ld, sum %lu\n", drive->DriveID(), offset, + disk.device.unknown.check_sums[i].sum)); + } + + index++; + } + + // If we get here, we couldn't find a way to differentiate all disks from each other. + // It's very likely that one disk is an exact copy of the other, so there is nothing + // we could do, anyway. + + dprintf("Could not make BIOS drives unique! Might boot from the wrong disk...\n"); +} + + +static status_t +add_block_devices(NodeList *devicesList, bool identifierMissing) +{ + if (sBlockDevicesAdded) + return B_OK; + + uint8 driveCount; + if (get_number_of_drives(&driveCount) != B_OK) + return B_ERROR; + + dprintf("number of drives: %d\n", driveCount); + + for (int32 i = 0; i < driveCount; i++) { + uint8 driveID = i + 0x80; + if (driveID == gBootDriveID) + continue; + + BlockHandle *drive = new(nothrow) BlockHandle(driveID); + if (drive->InitCheck() != B_OK) { + dprintf("could not add drive %u\n", driveID); + delete drive; + continue; + } + + devicesList->Add(drive); + + if (drive->FillIdentifier() != B_OK) + identifierMissing = true; + } + + if (identifierMissing) { + // we cannot distinguish between all drives by identifier, we need + // compute checksums for them + find_unique_check_sums(devicesList); + } + + sBlockDevicesAdded = true; + return B_OK; +} + + +// #pragma mark - + + +BlockHandle::BlockHandle(int handle) + : Handle(handle) +{ + TRACE(("drive ID %u\n", fHandle)); + + /* first check if the drive exists */ + /* note floppy B can be reported present anyway... */ + uint32 map = Drvmap(); + if (!(map & (1 << fHandle))) { + fSize = 0LL; + return; + } + //XXX: check size + + if (get_ext_drive_parameters(driveID, &fParameters) != B_OK) { + // old style CHS support + + if (get_drive_parameters(driveID, &fParameters) != B_OK) { + dprintf("getting drive parameters for: %u failed!\n", fDriveID); + return; + } + + TRACE((" cylinders: %lu, heads: %lu, sectors: %lu, bytes_per_sector: %u\n", + fParameters.cylinders, fParameters.heads, fParameters.sectors_per_track, + fParameters.bytes_per_sector)); + TRACE((" total sectors: %Ld\n", fParameters.sectors)); + + fBlockSize = 512; + fSize = fParameters.sectors * fBlockSize; + fLBA = false; + fHasParameters = false; + } else { + TRACE(("size: %x\n", fParameters.parameters_size)); + TRACE(("drive_path_signature: %x\n", fParameters.device_path_signature)); + TRACE(("host bus: \"%s\", interface: \"%s\"\n", fParameters.host_bus, + fParameters.interface_type)); + TRACE(("cylinders: %lu, heads: %lu, sectors: %lu, bytes_per_sector: %u\n", + fParameters.cylinders, fParameters.heads, fParameters.sectors_per_track, + fParameters.bytes_per_sector)); + TRACE(("total sectors: %Ld\n", fParameters.sectors)); + + fBlockSize = fParameters.bytes_per_sector; + fSize = fParameters.sectors * fBlockSize; + fLBA = true; + fHasParameters = true; + } +} + + +BlockHandle::~BlockHandle() +{ +} + + +status_t +BlockHandle::InitCheck() const +{ + return fSize > 0 ? B_OK : B_ERROR; +} + + +ssize_t +BlockHandle::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) +{ + int32 ret; + int sectorsPerBlocks = (fBlockSize / 256); + uint32 offset = pos % fBlockSize; + pos /= fBlockSize; + + uint32 blocksLeft = (bufferSize + offset + fBlockSize - 1) / fBlockSize; + int32 totalBytesRead = 0; + + //TRACE(("BIOS reads %lu bytes from %Ld (offset = %lu), drive %u\n", + // blocksLeft * fBlockSize, pos * fBlockSize, offset, fDriveID)); + + // read partial block + if (offset) { + ret = Rwabs(RW_READ | RW_NOTRANSLATE, gScratchBuffer, fBlockSize/256, -1, fHandle, pos * fBlockSize/256); + if (ret < 0) + return toserror(ret); + totalBytesRead += fBlockSize - offset; + memcpy(buffer, gScratchBuffer + offset, totalBytesRead); + + } + + uint32 scratchSize = SCRATCH_SIZE / fBlockSize; + + while (blocksLeft > 0) { + uint32 blocksRead = blocksLeft; + if (blocksRead > scratchSize) + blocksRead = scratchSize; + + int32 ret; + // XXX: check for AHDI 3.0 before using long recno!!! + ret = Rwabs(RW_READ | RW_NOTRANSLATE, gScratchBuffer, blocksRead * sectorsPerBlocks, -1, fHandle, pos * sectorsPerBlocks); + if (ret < 0) + return toserror(ret); + + uint32 bytesRead = fBlockSize * blocksRead - offset; + // copy no more than bufferSize bytes + if (bytesRead > bufferSize) + bytesRead = bufferSize; + + memcpy(buffer, (void *)(gScratchBuffer + offset), bytesRead); + pos += blocksRead; + offset = 0; + blocksLeft -= blocksRead; + bufferSize -= bytesRead; + buffer = (void *)((addr_t)buffer + bytesRead); + totalBytesRead += bytesRead; + } + + return totalBytesRead; +} + + +ssize_t +BlockHandle::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) +{ + // we don't have to know how to write + return B_NOT_ALLOWED; +} + + +off_t +BlockHandle::Size() const +{ + return fSize; +} + + +status_t +BlockHandle::FillIdentifier() +{ + if (HasParameters()) { + // try all drive_parameters versions, beginning from the most informative + +#if 0 + if (fill_disk_identifier_v3(fIdentifier, fParameters) == B_OK) + return B_OK; + + if (fill_disk_identifier_v2(fIdentifier, fParameters) == B_OK) + return B_OK; +#else + // TODO: the above version is the correct one - it's currently + // disabled, as the kernel boot code only supports the + // UNKNOWN_BUS/UNKNOWN_DEVICE way to find the correct boot + // device. + if (fill_disk_identifier_v3(fIdentifier, fParameters) != B_OK) + fill_disk_identifier_v2(fIdentifier, fParameters); + +#endif + + // no interesting information, we have to fall back to the default + // unknown interface/device type identifier + } + + fIdentifier.bus_type = UNKNOWN_BUS; + fIdentifier.device_type = UNKNOWN_DEVICE; + fIdentifier.device.unknown.size = Size(); + + for (int32 i = 0; i < NUM_DISK_CHECK_SUMS; i++) { + fIdentifier.device.unknown.check_sums[i].offset = -1; + fIdentifier.device.unknown.check_sums[i].sum = 0; + } + + return B_ERROR; +} + + +// #pragma mark - + + +status_t +platform_add_boot_device(struct stage2_args *args, NodeList *devicesList) +{ + TRACE(("boot drive ID: %x\n", gBootDriveID)); + + BlockHandle *drive = new(nothrow) BlockHandle(gBootDriveID); + if (drive->InitCheck() != B_OK) { + dprintf("no boot drive!\n"); + return B_ERROR; + } + + devicesList->Add(drive); + + if (drive->FillIdentifier() != B_OK) { + // We need to add all block devices to give the kernel the possibility + // to find the right boot volume + add_block_devices(devicesList, true); + } + + TRACE(("boot drive size: %Ld bytes\n", drive->Size())); + gKernelArgs.boot_volume.SetInt32(BOOT_VOLUME_BOOTED_FROM_IMAGE, + gBootedFromImage); + + return B_OK; +} + + +status_t +platform_get_boot_partition(struct stage2_args *args, Node *bootDevice, + NodeList *list, boot::Partition **_partition) +{ + BlockHandle *drive = static_cast(bootDevice); + off_t offset = (off_t)gBootPartitionOffset * drive->BlockSize(); + + dprintf("boot partition offset: %Ld\n", offset); + + NodeIterator iterator = list->GetIterator(); + boot::Partition *partition = NULL; + while ((partition = (boot::Partition *)iterator.Next()) != NULL) { + TRACE(("partition offset = %Ld, size = %Ld\n", partition->offset, partition->size)); + // search for the partition that contains the partition + // offset as reported by the BFS boot block + if (offset >= partition->offset + && offset < partition->offset + partition->size) { + *_partition = partition; + return B_OK; + } + } + + return B_ENTRY_NOT_FOUND; +} + + +status_t +platform_add_block_devices(stage2_args *args, NodeList *devicesList) +{ + return add_block_devices(devicesList, false); +} + + +status_t +platform_register_boot_device(Node *device) +{ + BlockHandle *drive = (BlockHandle *)device; + + check_cd_boot(drive); + + gKernelArgs.boot_volume.SetInt64("boot drive number", drive->DriveID()); + gKernelArgs.boot_volume.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE, + &drive->Identifier(), sizeof(disk_identifier)); + + return B_OK; +} + From bonefish at mail.berlios.de Fri Jan 11 01:36:47 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Jan 2008 01:36:47 +0100 Subject: [Haiku-commits] r23370 - in haiku/trunk: build/jam headers/private/kernel headers/private/kernel/arch headers/private/kernel/arch/x86 src/system/boot src/system/boot/arch/m68k src/system/boot/arch/ppc src/system/boot/arch/x86 src/system/kernel src/system/kernel/arch/x86 src/system/kernel/debug src/system/kernel/fs src/system/kernel/lib src/system/libroot/os src/system/libroot/os/arch/x86 src/system/libroot/posix/string src/system/libroot/posix/string/arch/x86 src/tools/gensyscalls Message-ID: <200801110036.m0B0alHi030804@sheep.berlios.de> Author: bonefish Date: 2008-01-11 01:36:44 +0100 (Fri, 11 Jan 2008) New Revision: 23370 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23370&view=rev Added: haiku/trunk/headers/private/kernel/arch/x86/arch_commpage.h haiku/trunk/headers/private/kernel/commpage.h haiku/trunk/src/system/kernel/arch/x86/arch_commpage.cpp haiku/trunk/src/system/kernel/arch/x86/arch_string.S haiku/trunk/src/system/kernel/arch/x86/asm_offsets.cpp haiku/trunk/src/system/kernel/commpage.cpp Removed: haiku/trunk/headers/private/kernel/arch/x86/commpage.h haiku/trunk/src/system/kernel/arch/x86/commpage.c Modified: haiku/trunk/build/jam/BuildSetup haiku/trunk/build/jam/KernelRules haiku/trunk/build/jam/MainBuildRules haiku/trunk/headers/private/kernel/arch/thread.h haiku/trunk/headers/private/kernel/arch/user_debugger.h haiku/trunk/headers/private/kernel/arch/x86/arch_cpu.h haiku/trunk/headers/private/kernel/arch/x86/arch_kernel.h haiku/trunk/headers/private/kernel/arch/x86/arch_thread.h haiku/trunk/headers/private/kernel/arch/x86/arch_thread_types.h haiku/trunk/headers/private/kernel/arch/x86/arch_user_debugger.h haiku/trunk/headers/private/kernel/ksyscalls.h haiku/trunk/headers/private/kernel/thread.h haiku/trunk/headers/private/kernel/thread_types.h haiku/trunk/headers/private/kernel/user_debugger.h haiku/trunk/src/system/boot/Jamfile haiku/trunk/src/system/boot/arch/m68k/Jamfile haiku/trunk/src/system/boot/arch/ppc/Jamfile haiku/trunk/src/system/boot/arch/x86/Jamfile haiku/trunk/src/system/kernel/Jamfile haiku/trunk/src/system/kernel/arch/x86/Jamfile haiku/trunk/src/system/kernel/arch/x86/arch_cpu.c haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp haiku/trunk/src/system/kernel/arch/x86/arch_int.c haiku/trunk/src/system/kernel/arch/x86/arch_interrupts.S haiku/trunk/src/system/kernel/arch/x86/arch_thread.c haiku/trunk/src/system/kernel/arch/x86/arch_user_debugger.cpp haiku/trunk/src/system/kernel/arch/x86/interrupts.h haiku/trunk/src/system/kernel/arch/x86/syscall.S haiku/trunk/src/system/kernel/debug/user_debugger.cpp haiku/trunk/src/system/kernel/fs/fd.cpp haiku/trunk/src/system/kernel/fs/vfs.cpp haiku/trunk/src/system/kernel/lib/Jamfile haiku/trunk/src/system/kernel/main.c haiku/trunk/src/system/kernel/real_time_clock.c haiku/trunk/src/system/kernel/signal.cpp haiku/trunk/src/system/kernel/syscalls.c haiku/trunk/src/system/kernel/thread.cpp haiku/trunk/src/system/libroot/os/arch/x86/syscalls.inc haiku/trunk/src/system/libroot/os/time.c haiku/trunk/src/system/libroot/posix/string/Jamfile haiku/trunk/src/system/libroot/posix/string/arch/x86/arch_string.S haiku/trunk/src/tools/gensyscalls/gensyscalls.cpp Log: Merged branch haiku/branches/developer/bonefish/optimization revision 23139 into trunk, with roughly the following changes (for details svn log the branch): * The int 99 syscall handler is now fully in assembly. * Added a sysenter/sysexit handler and use it on Pentiums that support it (via commpage). * Got rid of i386_handle_trap(). A bit of functionality was moved into the assembly handler which now uses a jump table to call C functions handling the respective interrupt. * Some optimizations to get user debugger support code out of the interrupt handling path. * Introduced a thread::flags fields which allows to skip handling of rare events (signals, user debug enabling/disabling) on the common interrupt handling path. * Got rid of the explicit iframe stack. The iframes can still be retrieved by iterating through the stack frames. * Made the commpage an architecture independent feature. It's used for the real time data stuff (instead of creating a separate area). * The x86 CPU modules can now provide processor optimized versions for common functions (currently memcpy() only). They are used in the kernel and are provided to the userland via commpage entries. * Introduced build system feature allowing easy use of C structure member offsets in assembly code. Changes after merging: * Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp (caused by refactoring and introduction of "call" debugger command). Modified: haiku/trunk/build/jam/BuildSetup =================================================================== --- haiku/trunk/build/jam/BuildSetup 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/build/jam/BuildSetup 2008-01-11 00:36:44 UTC (rev 23370) @@ -193,9 +193,10 @@ HAIKU_C++FLAGS += -Wno-multichar ; HAIKU_KERNEL_CCFLAGS += -finline -fno-builtin -Wno-multichar - -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ; + -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) ; HAIKU_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions -Wno-multichar - -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ; + -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) ; +HAIKU_KERNEL_DEFINES += _KERNEL_MODE ; if $(HAIKU_GCC_VERSION[1]) >= 3 { HAIKU_KERNEL_C++FLAGS += -fno-use-cxa-atexit ; @@ -432,6 +433,7 @@ -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ; HOST_KERNEL_C++FLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin -fno-exceptions -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ; +HOST_KERNEL_DEFINES += _KERNEL_MODE ; HOST_KERNEL_PIC_CCFLAGS = -fno-pic ; HOST_KERNEL_PIC_LINKFLAGS = ; @@ -647,6 +649,7 @@ HDRS CPPFLAGS CCFLAGS C++FLAGS LDFLAGS LINK LINKFLAGS DEFINES ARFLAGS UNARFLAGS + KERNEL_DEFINES KERNEL_CCFLAGS KERNEL_C++FLAGS KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS Modified: haiku/trunk/build/jam/KernelRules =================================================================== --- haiku/trunk/build/jam/KernelRules 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/build/jam/KernelRules 2008-01-11 00:36:44 UTC (rev 23370) @@ -20,6 +20,7 @@ # add kernel flags for the object ObjectCcFlags $(object) : $(TARGET_KERNEL_CCFLAGS) $(2) ; ObjectC++Flags $(object) : $(TARGET_KERNEL_C++FLAGS) $(2) ; + ObjectDefines $(object) : $(TARGET_KERNEL_DEFINES) ; # override warning flags TARGET_WARNING_CCFLAGS on $(object) = $(TARGET_KERNEL_WARNING_CCFLAGS) ; Modified: haiku/trunk/build/jam/MainBuildRules =================================================================== --- haiku/trunk/build/jam/MainBuildRules 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/build/jam/MainBuildRules 2008-01-11 00:36:44 UTC (rev 23370) @@ -212,7 +212,119 @@ $(LINK) $(LINKFLAGS) -o "$(1)" "$(2)" "$(NEEDLIBS)" $(LINKLIBS) } +rule CreateAsmStructOffsetsHeader header : source +{ + # CreateAsmStructOffsetsHeader header : source + # + # Grist will be added to both header and source. + header = [ FGristFiles $(header) ] ; + source = [ FGristFiles $(source) ] ; + + # find out which headers, defines, etc. to use + local headers ; + local sysHeaders ; + local defines ; + local flags ; + local includesSeparator ; + local localIncludesOption ; + local systemIncludesOption ; + + on $(header) { # use on $(1) variable values + if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) { + return ; + } + + # headers and defines + headers = $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ; + sysHeaders = $(SUBDIRSYSHDRS) $(SYSHDRS) ; + defines = $(DEFINES) ; + + if $(PLATFORM) = host { + sysHeaders += $(HOST_HDRS) ; + defines += $(HOST_DEFINES) ; + + if $(USES_BE_API) { + sysHeaders += $(HOST_BE_API_HEADERS) ; + } + + } else { + sysHeaders += $(TARGET_HDRS) ; + defines += $(TARGET_DEFINES) ; + } + + # optimization flags + if $(DEBUG) = 0 { + flags += $(OPTIM) ; + } else { + flags += -O0 ; + } + + if $(PLATFORM) = host { + # warning flags + if $(WARNINGS) != 0 { + flags += $(HOST_WARNING_C++FLAGS) ; + } + + # debug and other flags + flags += $(HOST_C++FLAGS) $(HOST_DEBUG_$(DEBUG)_C++FLAGS) + $(SUBDIRC++FLAGS) $(C++FLAGS) ; + + if $(USES_BE_API) { + flags += $(HOST_BE_API_C++FLAGS) ; + } + + C++ on $(header) = $(HOST_C++) ; + + includesSeparator = $(HOST_INCLUDES_SEPARATOR) ; + localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ; + systemIncludesOption = $(HOST_SYSTEM_INCLUDES_OPTION) ; + + } else { + # warning flags + if $(WARNINGS) != 0 { + flags += $(TARGET_WARNING_C++FLAGS) ; + } + + # debug and other flags + flags += $(TARGET_C++FLAGS) $(TARGET_DEBUG_$(DEBUG)_C++FLAGS) + $(SUBDIRC++FLAGS) $(C++FLAGS) ; + + C++ on $(header) = $(TARGET_C++) ; + + includesSeparator = $(TARGET_INCLUDES_SEPARATOR) ; + localIncludesOption = $(TARGET_LOCAL_INCLUDES_OPTION) ; + systemIncludesOption = $(TARGET_SYSTEM_INCLUDES_OPTION) ; + } + } + + # locate object, search for source, and set on target variables + + Depends $(header) : $(source) ; + SEARCH on $(source) += $(SEARCH_SOURCE) ; + MakeLocateArch $(header) ; + LocalClean clean : $(header) ; + + HDRRULE on $(source) = HdrRule ; + HDRSCAN on $(source) = $(HDRPATTERN) ; + HDRSEARCH on $(source) = $(headers) $(sysHeaders) $(STDHDRS) ; + HDRGRIST on $(source) = $(HDRGRIST) ; + + C++FLAGS on $(header) = $(flags) ; + CCHDRS on $(header) = [ FIncludes $(headers) : $(localIncludesOption) ] + $(includesSeparator) + [ FSysIncludes $(sysHeaders) : $(systemIncludesOption) ] ; + CCDEFS on $(header) = [ FDefines $(defines) ] ; + + CreateAsmStructOffsetsHeader1 $(header) : $(source) ; +} + +actions CreateAsmStructOffsetsHeader1 +{ + $(C++) -S "$(2)" $(C++FLAGS) $(CCDEFS) $(CCHDRS) -o - \ + | grep "#define" | sed -e 's/\$//' > "$(1)" +} + rule MergeObjectFromObjects { # MergeObjectFromObjects : : ; Modified: haiku/trunk/headers/private/kernel/arch/thread.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/thread.h 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/headers/private/kernel/arch/thread.h 2008-01-11 00:36:44 UTC (rev 23370) @@ -46,6 +46,9 @@ void arch_store_fork_frame(struct arch_fork_arg *arg); void arch_restore_fork_frame(struct arch_fork_arg *arg); +#define arch_syscall_64_bit_return_value() + // overridden by architectures that need special handling + #ifdef __cplusplus } #endif Modified: haiku/trunk/headers/private/kernel/arch/user_debugger.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/user_debugger.h 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/headers/private/kernel/arch/user_debugger.h 2008-01-11 00:36:44 UTC (rev 23370) @@ -22,6 +22,8 @@ void arch_clear_thread_debug_info(struct arch_thread_debug_info *info); void arch_destroy_thread_debug_info(struct arch_thread_debug_info *info); +void arch_update_thread_single_step(); + void arch_set_debug_cpu_state(const struct debug_cpu_state *cpuState); void arch_get_debug_cpu_state(struct debug_cpu_state *cpuState); @@ -29,6 +31,7 @@ status_t arch_clear_breakpoint(void *address); status_t arch_set_watchpoint(void *address, uint32 type, int32 length); status_t arch_clear_watchpoint(void *address); +bool arch_has_breakpoints(struct arch_team_debug_info *info); #if KERNEL_BREAKPOINTS status_t arch_set_kernel_breakpoint(void *address); Copied: haiku/trunk/headers/private/kernel/arch/x86/arch_commpage.h (from rev 23365, haiku/branches/developer/bonefish/optimization/headers/private/kernel/arch/x86/arch_commpage.h) Modified: haiku/trunk/headers/private/kernel/arch/x86/arch_cpu.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/x86/arch_cpu.h 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/headers/private/kernel/arch/x86/arch_cpu.h 2008-01-11 00:36:44 UTC (rev 23370) @@ -9,14 +9,21 @@ #define _KERNEL_ARCH_x86_CPU_H +#ifndef _ASSEMBLER + #include #include +#endif // !_ASSEMBLER + // MSR registers (possibly Intel specific) #define IA32_MSR_APIC_BASE 0x1b #define IA32_MSR_MTRR_CAPABILITIES 0xfe +#define IA32_MSR_SYSENTER_CS 0x174 +#define IA32_MSR_SYSENTER_ESP 0x175 +#define IA32_MSR_SYSENTER_EIP 0x176 #define IA32_MSR_MTRR_DEFAULT_TYPE 0x2ff #define IA32_MSR_MTRR_PHYSICAL_BASE_0 0x200 #define IA32_MSR_MTRR_PHYSICAL_MASK_0 0x201 @@ -81,6 +88,20 @@ #define IA32_MTR_WRITE_PROTECTED 5 #define IA32_MTR_WRITE_BACK 6 + +// iframe types +#define IFRAME_TYPE_SYSCALL 0x1 +#define IFRAME_TYPE_OTHER 0x2 +#define IFRAME_TYPE_MASK 0xf + + +#ifndef _ASSEMBLER + +typedef struct x86_optimized_functions { + void (*memcpy)(void* dest, const void* source, size_t count); + void* memcpy_end; +} x86_optimized_functions; + typedef struct x86_cpu_module_info { module_info info; uint32 (*count_mtrrs)(void); @@ -89,6 +110,8 @@ void (*set_mtrr)(uint32 index, uint64 base, uint64 length, uint8 type); status_t (*get_mtrr)(uint32 index, uint64 *_base, uint64 *_length, uint8 *_type); + + void (*get_optimized_functions)(x86_optimized_functions* functions); } x86_cpu_module_info; @@ -110,6 +133,7 @@ }; struct iframe { + uint32 type; // iframe type uint32 gs; uint32 fs; uint32 es; @@ -277,5 +301,6 @@ } // extern "C" { #endif +#endif // !_ASSEMBLER #endif /* _KERNEL_ARCH_x86_CPU_H */ Modified: haiku/trunk/headers/private/kernel/arch/x86/arch_kernel.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/x86/arch_kernel.h 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/headers/private/kernel/arch/x86/arch_kernel.h 2008-01-11 00:36:44 UTC (rev 23370) @@ -5,7 +5,9 @@ #ifndef _KERNEL_ARCH_x86_KERNEL_H #define _KERNEL_ARCH_x86_KERNEL_H -#include +#ifndef _ASSEMBLER +# include +#endif // memory layout #define KERNEL_BASE 0x80000000 Modified: haiku/trunk/headers/private/kernel/arch/x86/arch_thread.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/x86/arch_thread.h 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/headers/private/kernel/arch/x86/arch_thread.h 2008-01-11 00:36:44 UTC (rev 23370) @@ -16,15 +16,17 @@ extern "C" { #endif -void x86_push_iframe(struct iframe_stack *stack, struct iframe *frame); -void x86_pop_iframe(struct iframe_stack *stack); struct iframe *i386_get_user_iframe(void); void *x86_next_page_directory(struct thread *from, struct thread *to); void i386_return_from_signal(); void i386_end_return_from_signal(); +// override empty macro +#undef arch_syscall_64_bit_return_value +void arch_syscall_64_bit_return_value(); + static inline struct thread * arch_thread_get_current_thread(void) Modified: haiku/trunk/headers/private/kernel/arch/x86/arch_thread_types.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/x86/arch_thread_types.h 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/headers/private/kernel/arch/x86/arch_thread_types.h 2008-01-11 00:36:44 UTC (rev 23370) @@ -19,13 +19,6 @@ uint32 *ss; }; -#define IFRAME_TRACE_DEPTH 4 - -struct iframe_stack { - struct iframe *frames[IFRAME_TRACE_DEPTH]; - int32 index; -}; - // architecture specific thread info struct arch_thread { struct farcall current_stack; @@ -33,9 +26,6 @@ // 512 byte floating point save point - this must be 16 byte aligned uint8 fpu_state[512]; - - // used to track interrupts on this thread - struct iframe_stack iframes; } _ALIGNED(16); struct arch_team { Modified: haiku/trunk/headers/private/kernel/arch/x86/arch_user_debugger.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/x86/arch_user_debugger.h 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/headers/private/kernel/arch/x86/arch_user_debugger.h 2008-01-11 00:36:44 UTC (rev 23370) @@ -5,7 +5,7 @@ #ifndef _KERNEL_ARCH_X86_USER_DEBUGGER_H #define _KERNEL_ARCH_X86_USER_DEBUGGER_H -#define ARCH_INIT_USER_DEBUG i386_init_user_debug +#define ARCH_INIT_USER_DEBUG x86_init_user_debug // number of breakpoints the CPU supports // Actually it supports 4, but DR3 is used to hold the struct thread*. @@ -94,11 +94,6 @@ X86_BREAKPOINT_LENGTH_4 = 0x3, }; -// thread debug flags -enum { - X86_THREAD_DEBUG_DR7_SET = 0x01, -}; - struct arch_breakpoint { void *address; // NULL, if deactivated uint32 type; // one of the architecture types above @@ -122,14 +117,13 @@ struct iframe; struct thread; -extern void i386_init_user_debug_at_kernel_exit(struct iframe *frame); -extern void i386_exit_user_debug_at_kernel_entry(); -extern void i386_reinit_user_debug_after_context_switch(struct thread *thread); +extern void x86_init_user_debug_at_kernel_exit(struct iframe *frame); +extern void x86_exit_user_debug_at_kernel_entry(); -extern int i386_handle_debug_exception(struct iframe *frame); -extern int i386_handle_breakpoint_exception(struct iframe *frame); +extern void x86_handle_debug_exception(struct iframe *frame); +extern void x86_handle_breakpoint_exception(struct iframe *frame); -extern void i386_init_user_debug(); +extern void x86_init_user_debug(); #ifdef __cplusplus } Deleted: haiku/trunk/headers/private/kernel/arch/x86/commpage.h Copied: haiku/trunk/headers/private/kernel/commpage.h (from rev 23365, haiku/branches/developer/bonefish/optimization/headers/private/kernel/commpage.h) Modified: haiku/trunk/headers/private/kernel/ksyscalls.h =================================================================== --- haiku/trunk/headers/private/kernel/ksyscalls.h 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/headers/private/kernel/ksyscalls.h 2008-01-11 00:36:44 UTC (rev 23370) @@ -9,7 +9,7 @@ #include -typedef struct { +typedef struct syscall_info { void *function; // pointer to the syscall function int parameter_size; // summed up parameter size } syscall_info; Modified: haiku/trunk/headers/private/kernel/thread.h =================================================================== --- haiku/trunk/headers/private/kernel/thread.h 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/headers/private/kernel/thread.h 2008-01-11 00:36:44 UTC (rev 23370) @@ -26,9 +26,10 @@ struct thread *thread_dequeue(struct thread_queue *q); struct thread *thread_dequeue_id(struct thread_queue *q, thread_id id); -void thread_at_kernel_entry(void); +void thread_at_kernel_entry(bigtime_t now); // called when the thread enters the kernel on behalf of the thread void thread_at_kernel_exit(void); +void thread_at_kernel_exit_no_signals(void); void thread_reset_for_exec(void); status_t thread_init(struct kernel_args *args); @@ -69,6 +70,8 @@ status_t select_thread(int32 object, struct select_info *info, bool kernel); status_t deselect_thread(int32 object, struct select_info *info, bool kernel); +#define syscall_64_bit_return_value() arch_syscall_64_bit_return_value() + // used in syscalls.c status_t _user_set_thread_priority(thread_id thread, int32 newPriority); status_t _user_rename_thread(thread_id thread, const char *name); Modified: haiku/trunk/headers/private/kernel/thread_types.h =================================================================== --- haiku/trunk/headers/private/kernel/thread_types.h 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/headers/private/kernel/thread_types.h 2008-01-11 00:36:44 UTC (rev 23370) @@ -7,6 +7,7 @@ #ifndef _KERNEL_THREAD_TYPES_H #define _KERNEL_THREAD_TYPES_H +#ifndef _ASSEMBLER #include #include @@ -182,6 +183,9 @@ typedef int32 (*thread_entry_func)(thread_func, void *); struct thread { + int32 flags; // summary of events relevant in interrupt + // handlers (signals pending, user debugging + // enabled, etc.) struct thread *all_next; struct thread *team_next; struct thread *queue_next; /* i.e. run queue, release queue, etc. */ @@ -246,6 +250,7 @@ // stack area_id kernel_stack_area; addr_t kernel_stack_base; + addr_t kernel_stack_top; area_id user_stack_area; addr_t user_stack_base; size_t user_stack_size; @@ -268,4 +273,17 @@ struct thread *tail; }; + +#endif // !_ASSEMBLER + + +// bits for the thread::flags field +#define THREAD_FLAGS_SIGNALS_PENDING 0x01 +#define THREAD_FLAGS_DEBUG_THREAD 0x02 +#define THREAD_FLAGS_DEBUGGER_INSTALLED 0x04 +#define THREAD_FLAGS_BREAKPOINTS_DEFINED 0x08 +#define THREAD_FLAGS_BREAKPOINTS_INSTALLED 0x10 +#define THREAD_FLAGS_64_BIT_SYSCALL_RETURN 0x20 + + #endif /* _KERNEL_THREAD_TYPES_H */ Modified: haiku/trunk/headers/private/kernel/user_debugger.h =================================================================== --- haiku/trunk/headers/private/kernel/user_debugger.h 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/headers/private/kernel/user_debugger.h 2008-01-11 00:36:44 UTC (rev 23370) @@ -144,6 +144,7 @@ void init_user_debug(); + // debug event callbacks void user_debug_pre_syscall(uint32 syscall, void *args); @@ -155,6 +156,7 @@ void user_debug_stop_thread(); void user_debug_team_created(team_id teamID); void user_debug_team_deleted(team_id teamID, port_id debuggerPort); +void user_debug_update_new_thread_flags(thread_id threadID); void user_debug_thread_created(thread_id threadID); void user_debug_thread_deleted(team_id teamID, thread_id threadID); void user_debug_image_created(const image_info *imageInfo); Modified: haiku/trunk/src/system/boot/Jamfile =================================================================== --- haiku/trunk/src/system/boot/Jamfile 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/src/system/boot/Jamfile 2008-01-11 00:36:44 UTC (rev 23370) @@ -22,14 +22,8 @@ strchr.o strrchr.o strtol.o - arch_string.o ; -local platformObjects = ; -if $(TARGET_ARCH) = x86 { - platformObjects += cpuid.o ; -} - AddResources zbeos : boot_loader.rdef ; KernelLd boot_loader_$(TARGET_BOOT_PLATFORM) : @@ -50,9 +44,6 @@ # kernel) $(librootFunctions:G=src!system!kernel!lib) - # platform specific objects - $(platformObjects) - : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/boot_loader_$(TARGET_BOOT_PLATFORM).ld : -Bstatic ; Modified: haiku/trunk/src/system/boot/arch/m68k/Jamfile =================================================================== --- haiku/trunk/src/system/boot/arch/m68k/Jamfile 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/src/system/boot/arch/m68k/Jamfile 2008-01-11 00:36:44 UTC (rev 23370) @@ -1,17 +1,14 @@ SubDir HAIKU_TOP src system boot arch m68k ; -{ - local defines = - _BOOT_MODE - ; +DEFINES += _BOOT_MODE ; - defines = [ FDefines $(defines) ] ; - SubDirCcFlags $(defines) -Wall -Wno-multichar ; - SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-rtti ; -} +local librootArchObjects = + arch_string.o +; KernelMergeObject boot_arch_m68k.o : arch_elf.cpp + $(librootArchObjects) ; SEARCH on [ FGristFiles arch_elf.cpp ] Modified: haiku/trunk/src/system/boot/arch/ppc/Jamfile =================================================================== --- haiku/trunk/src/system/boot/arch/ppc/Jamfile 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/src/system/boot/arch/ppc/Jamfile 2008-01-11 00:36:44 UTC (rev 23370) @@ -1,17 +1,14 @@ SubDir HAIKU_TOP src system boot arch ppc ; -{ - local defines = - _BOOT_MODE - ; +DEFINES += _BOOT_MODE ; - defines = [ FDefines $(defines) ] ; - SubDirCcFlags $(defines) -Wall -Wno-multichar ; - SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-rtti ; -} +local librootArchObjects = + arch_string.o +; KernelMergeObject boot_arch_ppc.o : arch_elf.cpp + $(librootArchObjects) ; SEARCH on [ FGristFiles arch_elf.cpp ] Modified: haiku/trunk/src/system/boot/arch/x86/Jamfile =================================================================== --- haiku/trunk/src/system/boot/arch/x86/Jamfile 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/src/system/boot/arch/x86/Jamfile 2008-01-11 00:36:44 UTC (rev 23370) @@ -1,18 +1,22 @@ SubDir HAIKU_TOP src system boot arch x86 ; -{ - local defines = - _BOOT_MODE - ; +DEFINES += _BOOT_MODE ; - defines = [ FDefines $(defines) ] ; - SubDirCcFlags $(defines) -Wall -Wno-multichar ; - SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-rtti ; -} +local kernelArchSources = + arch_elf.c + arch_string.S +; +local kernelArchObjects = + cpuid.o +; + KernelMergeObject boot_arch_x86.o : - arch_elf.c + $(kernelArchSources) + : # additional flags + : + $(kernelArchObjects) ; -SEARCH on [ FGristFiles arch_elf.c ] +SEARCH on [ FGristFiles $(kernelArchSources) ] = [ FDirName $(HAIKU_TOP) src system kernel arch $(TARGET_ARCH) ] ; Modified: haiku/trunk/src/system/kernel/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/Jamfile 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/src/system/kernel/Jamfile 2008-01-11 00:36:44 UTC (rev 23370) @@ -16,6 +16,7 @@ KernelMergeObject kernel_core.o : boot_item.cpp + commpage.cpp condition_variable.cpp cpu.c elf.cpp Modified: haiku/trunk/src/system/kernel/arch/x86/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/Jamfile 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/src/system/kernel/arch/x86/Jamfile 2008-01-11 00:36:44 UTC (rev 23370) @@ -11,6 +11,7 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ; KernelStaticLibrary libx86 : + arch_commpage.cpp arch_cpu.c arch_debug.cpp arch_debug_console.c @@ -20,6 +21,7 @@ # arch_selector.c arch_real_time_clock.c arch_smp.c + arch_string.S arch_thread.c arch_timer.c arch_vm.cpp @@ -31,7 +33,6 @@ apm.cpp bios.cpp cpuid.S - commpage.c syscall.S generic_vm_physical_page_mapper.cpp @@ -39,6 +40,10 @@ $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused ; +CreateAsmStructOffsetsHeader asm_offsets.h : asm_offsets.cpp ; + # We need to specify the dependency on the generated syscalls file explicitly. Includes [ FGristFiles arch_x86.S arch_interrupts.S ] : syscall_numbers.h ; +Includes [ FGristFiles arch_interrupts.S ] + : syscall_table.h ; Copied: haiku/trunk/src/system/kernel/arch/x86/arch_commpage.cpp (from rev 23365, haiku/branches/developer/bonefish/optimization/src/system/kernel/arch/x86/arch_commpage.cpp) Modified: haiku/trunk/src/system/kernel/arch/x86/arch_cpu.c =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_cpu.c 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/src/system/kernel/arch/x86/arch_cpu.c 2008-01-11 00:36:44 UTC (rev 23370) @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -21,7 +22,6 @@ #include #include #include -#include #include "interrupts.h" @@ -76,6 +76,16 @@ static x86_cpu_module_info *sCpuModule; + +extern void memcpy_generic(void* dest, const void* source, size_t count); +extern int memcpy_generic_end; + +x86_optimized_functions gOptimizedFunctions = { + .memcpy = memcpy_generic, + .memcpy_end = &memcpy_generic_end +}; + + /** Disable CPU caches, and invalidate them. */ static void @@ -516,9 +526,6 @@ // setup SSE2/3 support init_sse(); - // initialize the commpage support - commpage_init(); - return B_OK; } @@ -545,6 +552,24 @@ if (x86_count_mtrrs() > 0) call_all_cpus(&init_mtrrs, NULL); + // get optimized functions from the CPU module + if (sCpuModule != NULL && sCpuModule->get_optimized_functions != NULL) { + x86_optimized_functions functions; + memset(&functions, 0, sizeof(functions)); + + sCpuModule->get_optimized_functions(&functions); + + if (functions.memcpy != NULL) { + gOptimizedFunctions.memcpy = functions.memcpy; + gOptimizedFunctions.memcpy_end = functions.memcpy_end; + } + } + + // put the optimized functions into the commpage + fill_commpage_entry(COMMPAGE_ENTRY_X86_MEMCPY, gOptimizedFunctions.memcpy, + (addr_t)gOptimizedFunctions.memcpy_end + - (addr_t)gOptimizedFunctions.memcpy); + return B_OK; } Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp 2008-01-11 00:36:44 UTC (rev 23370) @@ -145,7 +145,7 @@ static void setup_for_thread(char *arg, struct thread **_thread, uint32 *_ebp, - struct iframe_stack **_frameStack, uint32 *_oldPageDirectory) + uint32 *_oldPageDirectory) { struct thread *thread = NULL; @@ -180,21 +180,60 @@ thread = thread_get_current_thread(); } - // We don't have a thread pointer early in the boot process - if (thread != NULL) - *_frameStack = &thread->arch_info.iframes; - else - *_frameStack = &gBootFrameStack; - *_thread = thread; } +static bool +is_kernel_stack_address(struct thread* thread, addr_t address) +{ + // We don't have a thread pointer in the early boot process, but then we are + // on the kernel stack for sure. + if (thread == NULL) + return IS_KERNEL_ADDRESS(address); + + return address >= thread->kernel_stack_base + && address < thread->kernel_stack_base + KERNEL_STACK_SIZE; +} + + +static bool +is_iframe(struct thread* thread, addr_t frame) +{ + return is_kernel_stack_address(thread, frame) + && (*(addr_t*)frame & ~IFRAME_TYPE_MASK) == 0; +} + + +static struct iframe * +find_previous_iframe(struct thread *thread, addr_t frame) +{ + // iterate backwards through the stack frames, until we hit an iframe + while (is_kernel_stack_address(thread, frame)) { + if (is_iframe(thread, frame)) + return (struct iframe*)frame; + + frame = *(addr_t*)frame; + } + + return NULL; +} + + +static struct iframe* +get_previous_iframe(struct thread* thread, struct iframe* frame) +{ + if (frame == NULL) + return NULL; + + return find_previous_iframe(thread, frame->ebp); +} + + static int stack_trace(int argc, char **argv) { uint32 previousLocations[NUM_PREVIOUS_LOCATIONS]; - struct iframe_stack *frameStack; struct thread *thread = NULL; addr_t oldPageDirectory = 0; uint32 ebp = x86_read_ebp(); @@ -205,7 +244,7 @@ return 0; } - setup_for_thread(argc == 2 ? argv[1] : NULL, &thread, &ebp, &frameStack, + setup_for_thread(argc == 2 ? argv[1] : NULL, &thread, &ebp, &oldPageDirectory); if (thread != NULL) { @@ -224,18 +263,14 @@ kprintf("frame caller :function + offset\n"); + bool onKernelStack = true; + for (;;) { - bool isIFrame = false; - // see if the ebp matches the iframe - for (i = 0; i < frameStack->index; i++) { - if (ebp == ((uint32)frameStack->frames[i] - 8)) { - // it's an iframe - isIFrame = true; - } - } + onKernelStack = onKernelStack + && is_kernel_stack_address(thread, ebp); - if (isIFrame) { - struct iframe *frame = (struct iframe *)(ebp + 8); + if (onKernelStack && is_iframe(thread, ebp)) { + struct iframe *frame = (struct iframe *)ebp; print_iframe(frame); print_stack_frame(thread, frame->eip, ebp, frame->ebp); @@ -328,7 +363,6 @@ static int show_call(int argc, char **argv) { - struct iframe_stack *frameStack; struct thread *thread = NULL; addr_t oldPageDirectory = 0; uint32 ebp = x86_read_ebp(); @@ -348,7 +382,7 @@ return 0; } - setup_for_thread(argc == 3 ? argv[1] : NULL, &thread, &ebp, &frameStack, + setup_for_thread(argc == 3 ? argv[1] : NULL, &thread, &ebp, &oldPageDirectory); int32 callIndex = strtoul(argv[argc == 3 ? 2 : 1], NULL, 0); @@ -356,20 +390,15 @@ if (thread != NULL) kprintf("thread %ld, %s\n", thread->id, thread->name); - int32 index = 1; - for (; index <= callIndex; index++) { - bool isIFrame = false; - // see if the ebp matches the iframe - for (int32 i = 0; i < frameStack->index; i++) { - if (ebp == ((uint32)frameStack->frames[i] - 8)) { - // it's an iframe - isIFrame = true; - } - } + bool onKernelStack = true; - if (isIFrame) { - struct iframe *frame = (struct iframe *)(ebp + 8); + for (int32 index = 1; index <= callIndex; index++) { + onKernelStack = onKernelStack + && is_kernel_stack_address(thread, ebp); + if (onKernelStack && is_iframe(thread, ebp)) { + struct iframe *frame = (struct iframe *)ebp; + if (index == callIndex) print_call(thread, frame->eip, ebp, argCount); @@ -406,7 +435,6 @@ static int dump_iframes(int argc, char **argv) { - struct iframe_stack *frameStack; struct thread *thread = NULL; int32 i; @@ -424,17 +452,13 @@ return 0; } - // We don't have a thread pointer early in the boot process if (thread != NULL) - frameStack = &thread->arch_info.iframes; - else - frameStack = &gBootFrameStack; - - if (thread != NULL) kprintf("iframes for thread 0x%lx \"%s\"\n", thread->id, thread->name); - for (i = 0; i < frameStack->index; i++) { - print_iframe(frameStack->frames[i]); + struct iframe* frame = find_previous_iframe(thread, x86_read_ebp()); + while (frame != NULL) { + print_iframe(frame); + frame = get_previous_iframe(thread, frame); } return 0; Modified: haiku/trunk/src/system/kernel/arch/x86/arch_int.c =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_int.c 2008-01-11 00:22:09 UTC (rev 23369) +++ haiku/trunk/src/system/kernel/arch/x86/arch_int.c 2008-01-11 00:36:44 UTC (rev 23370) @@ -99,8 +99,6 @@ #define MAX_ARGS 16 -struct iframe_stack gBootFrameStack; - typedef struct { uint32 a, b; } desc_table; @@ -109,7 +107,13 @@ static uint16 sLevelTriggeredInterrupts; // binary mask: 1 level, 0 edge +// 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]; + static void set_gate(desc_table *gate_addr, addr_t addr, int type, int dpl) { @@ -320,259 +324,192 @@ static void -fatal_exception(struct iframe *frame) +invalid_exception(struct iframe* frame) { + struct thread* thread = thread_get_current_thread(); char name[32]; - panic("Fatal exception \"%s\" occurred! Error code: 0x%lx\n", - exception_name(frame->vector, name, sizeof(name)), frame->error_code); + panic("unhandled trap 0x%lx (%s) at ip 0x%lx, thread 0x%lx!\n", + frame->vector, exception_name(frame->vector, name, sizeof(name)), + frame->eip, thread ? thread->id : -1); } [... truncated: 2200 lines follow ...] From bonefish at mail.berlios.de Fri Jan 11 01:44:22 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Jan 2008 01:44:22 +0100 Subject: [Haiku-commits] r23371 - haiku/trunk/src/tests/system/benchmarks Message-ID: <200801110044.m0B0iMAD031463@sheep.berlios.de> Author: bonefish Date: 2008-01-11 01:44:22 +0100 (Fri, 11 Jan 2008) New Revision: 23371 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23371&view=rev Added: haiku/trunk/src/tests/system/benchmarks/compile_bench.sh Log: Script that times 100 compilations of a hello world C program. Under Haiku it is rather slow (on my machine about 80% slower than on Zeta) and sometimes a compilation even fails, due to what looks to me like a problem with gcc's subprocess synchronization (our wait()/waitpid() or friends might have some race condition). Added: haiku/trunk/src/tests/system/benchmarks/compile_bench.sh =================================================================== --- haiku/trunk/src/tests/system/benchmarks/compile_bench.sh 2008-01-11 00:36:44 UTC (rev 23370) +++ haiku/trunk/src/tests/system/benchmarks/compile_bench.sh 2008-01-11 00:44:22 UTC (rev 23371) @@ -0,0 +1,34 @@ +#!/bin/sh + +testDir=/tmp/compile_bench +rm -rf $testDir +mkdir -p $testDir +cd $testDir + +cat << EOF > hello_world.cpp +#include + +int +main() +{ + printf("Hello world!\n"); + return 0; +} + +EOF + +compile_all() +{ + for f in $(seq 100); do + echo -n . + g++ -o $f ${f}.cpp + done +} + +for f in $(seq 100); do + cp hello_world.cpp ${f}.cpp +done + +time compile_all + +rm -rf $testDir Property changes on: haiku/trunk/src/tests/system/benchmarks/compile_bench.sh ___________________________________________________________________ Name: svn:executable + * From mmu_man at mail.berlios.de Fri Jan 11 01:58:10 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 01:58:10 +0100 Subject: [Haiku-commits] r23372 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801110058.m0B0wAPp001905@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 01:58:10 +0100 (Fri, 11 Jan 2008) New Revision: 23372 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23372&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp Log: More block device stuff. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp 2008-01-11 00:44:22 UTC (rev 23371) +++ haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp 2008-01-11 00:58:10 UTC (rev 23372) @@ -36,7 +36,9 @@ static const uint16 kDevicePathSignature = 0xbedd; +//XXX clean this up! struct drive_parameters { + struct tosbpb bpb; uint16 parameters_size; uint16 flags; uint32 cylinders; @@ -45,7 +47,7 @@ uint64 sectors; uint16 bytes_per_sector; /* edd 2.0 */ - real_addr device_table; + //real_addr device_table; /* edd 3.0 */ uint16 device_path_signature; uint8 device_path_size; @@ -130,7 +132,7 @@ uint8 DriveID() const { return fHandle; } protected: - bool fLBA; + status_t ReadBPB(struct tosbpb *bpb); uint64 fSize; uint32 fBlockSize; bool fHasParameters; @@ -142,66 +144,7 @@ static bool sBlockDevicesAdded = false; -static void -check_cd_boot(BlockHandle *drive) -{ - gKernelArgs.boot_volume.SetInt32(BOOT_METHOD, BOOT_METHOD_HARD_DISK); - - if (drive->DriveID() != 0) - return; - - struct bios_regs regs; - regs.eax = BIOS_BOOT_CD_GET_STATUS; - regs.edx = 0; - regs.esi = kDataSegmentScratch; - call_bios(0x13, ®s); - - if ((regs.flags & CARRY_FLAG) != 0) - return; - - // we obviously were booted from CD! - - specification_packet *packet = (specification_packet *)kDataSegmentScratch; - if (packet->media_type != 0) - gKernelArgs.boot_volume.SetInt32(BOOT_METHOD, BOOT_METHOD_CD); - -#if 0 - dprintf("got CD boot spec:\n"); - dprintf(" size: %#x\n", packet->size); - dprintf(" media type: %u\n", packet->media_type); - dprintf(" drive_number: %u\n", packet->drive_number); - dprintf(" controller index: %u\n", packet->controller_index); - dprintf(" start emulation: %lu\n", packet->start_emulation); - dprintf(" device_specification: %u\n", packet->device_specification); -#endif -} - - static status_t -get_ext_drive_parameters(uint8 drive, drive_parameters *targetParameters) -{ - drive_parameters *parameter = (drive_parameters *)kDataSegmentScratch; - - memset(parameter, 0, sizeof(drive_parameters)); - parameter->parameters_size = sizeof(drive_parameters); - - struct bios_regs regs; - regs.eax = BIOS_GET_EXT_DRIVE_PARAMETERS; - regs.edx = drive; - regs.esi = (addr_t)parameter - kDataSegmentBase; - call_bios(0x13, ®s); - - // filter out faulty BIOS return codes - if ((regs.flags & CARRY_FLAG) != 0 - || parameter->sectors == 0) - return B_ERROR; - - memcpy(targetParameters, parameter, sizeof(drive_parameters)); - return B_OK; -} - - -static status_t get_drive_parameters(uint8 drive, drive_parameters *parameters) { struct bios_regs regs; @@ -229,24 +172,6 @@ } -static status_t -get_number_of_drives(uint8 *_count) -{ - struct bios_regs regs; - regs.eax = BIOS_GET_DRIVE_PARAMETERS; - regs.edx = 0x80; - regs.es = 0; - regs.edi = 0; - call_bios(0x13, ®s); - - if (regs.flags & CARRY_FLAG) - return B_ERROR; - - *_count = regs.edx & 0xff; - return B_OK; -} - - /** parse EDD 3.0 drive path information */ static status_t @@ -460,17 +385,20 @@ static status_t add_block_devices(NodeList *devicesList, bool identifierMissing) { + int32 map; + uint8 driveID; + uint8 driveCount; + if (sBlockDevicesAdded) return B_OK; - uint8 driveCount; - if (get_number_of_drives(&driveCount) != B_OK) - return B_ERROR; - - dprintf("number of drives: %d\n", driveCount); - - for (int32 i = 0; i < driveCount; i++) { - uint8 driveID = i + 0x80; + map = Drvmap(); + for (driveID = 0; driveID < 32; driveID++) { + bool present = map & 0x1; + map >>= 1; + if (!present) + continue; + if (driveID == gBootDriveID) continue; @@ -486,6 +414,7 @@ if (drive->FillIdentifier() != B_OK) identifierMissing = true; } + dprintf("number of drives: %d\n", driveCount); if (identifierMissing) { // we cannot distinguish between all drives by identifier, we need @@ -671,6 +600,19 @@ } +status_t +BlockHandle::ReadBPB(struct tosbpb *bpb) +{ + struct tosbpb *p; + p = Getbpb(fHandle); + memcpy(bpb, p, sizeof(struct tosbpb)); + /* Getbpb is buggy so we must force a media change */ + //XXX: docs seems to assume we should loop until it works + Mediach(fHandle); + return B_OK; +} + + // #pragma mark - From marcusoverhagen at mail.berlios.de Fri Jan 11 02:10:02 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Fri, 11 Jan 2008 02:10:02 +0100 Subject: [Haiku-commits] r23373 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801110110.m0B1A2NC003190@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-11 02:10:00 +0100 (Fri, 11 Jan 2008) New Revision: 23373 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23373&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c Log: implemented basic atapi support framework. improved device detection. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-11 00:58:10 UTC (rev 23372) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-11 01:10:00 UTC (rev 23373) @@ -22,26 +22,42 @@ ata_select_device(ide_bus_info *bus, int device) { ide_task_file tf; + +// FLOW("ata_select_device device %d\n", device); + tf.chs.head = 0; tf.chs.mode = ide_mode_lba; tf.chs.device = device ? 1 : 0; +// if (ata_wait_idle(bus) != B_OK) +// FLOW("ata_select_device step 1 bus not idle\n"); + bus->controller->write_command_block_regs(bus->channel_cookie, &tf, ide_mask_device_head); + bus->controller->get_altstatus(bus->channel_cookie); // flush posted writes spin(1); // wait 400 nsec + +// if (ata_wait_idle(bus) != B_OK) +// FLOW("ata_select_device step 2 bus not idle\n"); + + // for debugging only + bus->controller->read_command_block_regs(bus->channel_cookie, &tf, ide_mask_device_head); + if (tf.chs.device != device) + TRACE("ata_select_device result: device %d not selected! head 0x%x, mode 0x%x, device %d\n", device, tf.chs.head, tf.chs.mode, tf.chs.device); } void ata_select(ide_device_info *device) { -// ata_select_device(device->bus, device->is_device1); - - ASSERT(device->is_device1 == device->tf.chs.device); - device->bus->controller->write_command_block_regs(device->bus->channel_cookie, &device->tf, ide_mask_device_head); + ata_select_device(device->bus, device->is_device1); } +/* Detect if the device is present + * This is unrelyable for some controllers and + * may report false posives. + */ bool ata_is_device_present(ide_bus_info *bus, int device) { @@ -51,10 +67,10 @@ tf.lba.sector_count = 0xaa; tf.lba.lba_0_7 = 0x55; - bus->controller->write_command_block_regs(bus->channel_cookie, &tf, ide_mask_sector_count | ide_mask_LBA_low); - spin(1); // wait 400 nsec + bus->controller->get_altstatus(bus->channel_cookie); // flush posted writes + spin(1); bus->controller->read_command_block_regs(bus->channel_cookie, &tf, ide_mask_sector_count | ide_mask_LBA_low); @@ -74,9 +90,10 @@ bool check_err, bigtime_t timeout) { bigtime_t startTime = system_time(); - bigtime_t elapsedTime; + bigtime_t elapsedTime = 0; uint8 status; + bus->controller->get_altstatus(bus->channel_cookie); // flush posted writes spin(1); // device needs 400ns to set status for (;;) { @@ -85,18 +102,20 @@ if (check_err && (status & ide_status_err) != 0) return B_ERROR; - if ((status & set) == set && (status & cleared) == 0) + if ((status & set) == set && (status & cleared) == 0) { + dprintf("ata_wait: set %x, cleared %x, elapsed time %lld\n", set, cleared, elapsedTime); return B_OK; + } elapsedTime = system_time() - startTime; if (elapsedTime > timeout) return B_TIMED_OUT; - if (elapsedTime < 5000) + if (elapsedTime < 100000) spin(1); else - snooze(5000); + snooze(3000); } } @@ -125,6 +144,14 @@ } +// wait 20ms for device to report idle (busy and drq clear) +status_t +ata_wait_idle(ide_bus_info *bus) +{ + return ata_wait(bus, 0, ide_status_bsy | ide_status_drq, false, 20000); +} + + // busy wait for device beeing ready, // using the timeout set by the previous ata_send_command status_t @@ -163,7 +190,7 @@ ata_select(device); - if (ata_wait(bus, 0, ide_status_bsy | ide_status_drq, false, 50000) != B_OK) { + if (ata_wait_idle(bus) != B_OK) { // resetting the device here will discard current configuration, // it's better when the SCSI bus manager requests an external reset. TRACE("device selection timeout\n"); @@ -181,7 +208,7 @@ if (bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, device->tf_param_mask) != B_OK) goto err; - FLOW("Writing command 0x%02x", (int)device->tf.write.command); + FLOW("Writing command 0x%02x\n", (int)device->tf.write.command); IDE_LOCK(bus); @@ -216,6 +243,15 @@ } status_t +ata_read_status(ide_device_info *device, uint8 *status) +{ + status_t result = device->bus->controller->read_command_block_regs(device->bus->channel_cookie, &device->tf, ide_mask_status); + if (status) + *status = device->tf.read.status; +} + + +status_t ata_finish_command(ide_device_info *device) { return B_OK; @@ -237,23 +273,28 @@ devicePresent0 = ata_is_device_present(bus, 0); devicePresent1 = ata_is_device_present(bus, 1); - dprintf("ATA: reset_bus: ata_is_device_present device 0, present %d\n", devicePresent0); - dprintf("ATA: reset_bus: ata_is_device_present device 1, present %d\n", devicePresent1); + dprintf("ATA: reset_bus: device 0: %s present\n", devicePresent0 ? "might be" : "is not"); + dprintf("ATA: reset_bus: device 1: %s present\n", devicePresent1 ? "might be" : "is not"); + // select device 0 + ata_select_device(bus, 0); + // disable interrupts and assert SRST for at least 5 usec if (controller->write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien | ide_devctrl_srst) != B_OK) goto error; + controller->get_altstatus(channel); // flush posted writes spin(20); // clear SRST and wait for at least 2 ms but (we wait 150ms like everyone else does) if (controller->write_device_control(channel, ide_devctrl_bit3 | ide_devctrl_nien) != B_OK) goto error; + controller->get_altstatus(channel); // flush posted writes snooze(150000); if (devicePresent0) { ata_select_device(bus, 0); - dprintf("altstatus device 0: %x\n", controller->get_altstatus(channel)); +// dprintf("altstatus device 0: %x\n", controller->get_altstatus(channel)); // wait up to 31 seconds for busy to clear, abort when error is set status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); @@ -283,7 +324,7 @@ if (devicePresent1) { ata_select_device(bus, 1); - dprintf("altstatus device 1: %x\n", controller->get_altstatus(channel)); +// dprintf("altstatus device 1: %x\n", controller->get_altstatus(channel)); // wait up to 31 seconds for busy to clear, abort when error is set status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); @@ -1042,6 +1083,9 @@ goto error; } + // clear pending interrupt + ata_read_status(device, NULL); + // XXX fix me IDE_LOCK(bus); bus->state = ata_state_busy; @@ -1051,6 +1095,11 @@ return B_OK; error: + + // clear pending interrupt + ata_read_status(device, NULL); + + // XXX fix me IDE_LOCK(bus); bus->state = ata_state_busy; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-11 00:58:10 UTC (rev 23372) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-11 01:10:00 UTC (rev 23373) @@ -449,7 +449,26 @@ void atapi_exec_io(ide_device_info *device, ata_request *request) { + scsi_ccb *ccb = request->ccb; + TRACE("atapi_exec_io\n"); + + if (ccb->cdb[0] == SCSI_OP_REQUEST_SENSE) { + // No initial clear sense, as this request is used + // by the scsi stack to request the sense data of + // the previous command. + scsi_request_sense(device, request); + ata_request_finish(request, false /* no resubmit */); + return; + } + + ata_request_clear_sense(request); + + FLOW("command not implemented\n"); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_OPCODE); + ata_request_finish(request, false /* no resubmit */); + + /* scsi_ccb *ccb = request->ccb; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-11 00:58:10 UTC (rev 23372) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-11 01:10:00 UTC (rev 23373) @@ -271,6 +271,7 @@ struct scsi_sense; void scsi_set_sense(struct scsi_sense *sense, const ata_request *request); +void scsi_request_sense(ide_device_info *device, ata_request *request); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-11 00:58:10 UTC (rev 23372) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-11 01:10:00 UTC (rev 23373) @@ -122,9 +122,8 @@ // there is no initiator for IDE, but SCSI needs it for scanning info->initiator_id = 2; - // there's no controller limit, so set it higher then the maximum - // number of queued requests, which is 32 per device * 2 devices - info->hba_queue_size = 65; + // we only support 1 request at a time + info->hba_queue_size = 1; strncpy(info->sim_vid, "Haiku", SCSI_SIM_ID); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-11 00:58:10 UTC (rev 23372) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-11 01:10:00 UTC (rev 23373) @@ -398,7 +398,7 @@ } -static void +void scsi_request_sense(ide_device_info *device, ata_request *request) { scsi_ccb *ccb = request->ccb; From mmu_man at mail.berlios.de Fri Jan 11 02:13:02 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 02:13:02 +0100 Subject: [Haiku-commits] r23374 - haiku/trunk/src/system/boot/arch/m68k Message-ID: <200801110113.m0B1D2XW003819@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 02:13:02 +0100 (Fri, 11 Jan 2008) New Revision: 23374 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23374&view=rev Modified: haiku/trunk/src/system/boot/arch/m68k/Jamfile Log: Seems the ppc way of reusing arch_string.o doesn't work for me. Modified: haiku/trunk/src/system/boot/arch/m68k/Jamfile =================================================================== --- haiku/trunk/src/system/boot/arch/m68k/Jamfile 2008-01-11 01:10:00 UTC (rev 23373) +++ haiku/trunk/src/system/boot/arch/m68k/Jamfile 2008-01-11 01:13:02 UTC (rev 23374) @@ -3,7 +3,8 @@ DEFINES += _BOOT_MODE ; local librootArchObjects = - arch_string.o +# arch_string.o + arch_string.S ; KernelMergeObject boot_arch_m68k.o : @@ -13,3 +14,6 @@ SEARCH on [ FGristFiles arch_elf.cpp ] = [ FDirName $(HAIKU_TOP) src system kernel arch $(TARGET_ARCH) ] ; + +SEARCH on [ FGristFiles $(librootArchObjects) ] + = [ FDirName $(HAIKU_TOP) src system libroot posix string arch $(TARGET_ARCH) ] ; From mmu_man at mail.berlios.de Fri Jan 11 02:13:37 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 02:13:37 +0100 Subject: [Haiku-commits] r23375 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801110113.m0B1DbHH003940@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 02:13:37 +0100 (Fri, 11 Jan 2008) New Revision: 23375 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23375&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp Log: toscalls.h after other headers. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp 2008-01-11 01:13:02 UTC (rev 23374) +++ haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp 2008-01-11 01:13:37 UTC (rev 23375) @@ -4,8 +4,6 @@ */ -#include "toscalls.h" - #include #include #include @@ -14,6 +12,8 @@ #include +#include "toscalls.h" + //#define TRACE_DEVICES #ifdef TRACE_DEVICES # define TRACE(x) dprintf x From axeld at mail.berlios.de Fri Jan 11 02:32:49 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 11 Jan 2008 02:32:49 +0100 Subject: [Haiku-commits] r23376 - haiku/trunk/src/kits/tracker Message-ID: <200801110132.m0B1WnuR006075@sheep.berlios.de> Author: axeld Date: 2008-01-11 02:32:47 +0100 (Fri, 11 Jan 2008) New Revision: 23376 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23376&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp Log: * Finally nailed down and fixed #355: apparently, if the pose info attribute couldn't be read from a file, Tracker would try 10 times with a 10 ms timeout - but only if the creation time equals the modification time! That was obviously supposed to be a check if the file was recent... Now that computers are faster (even when running Haiku), it may actually take less than one second to copy a file, so most files on the Haiku image satisfied this thoughtful and future-proof check. (And no, even the original BFS does not automatically increase the modified time on close.) * Now, mmlr came up with a better check: we just check the file's creation time against the current time to see if it's a recent file. That should work a bit more reliable :-) Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2008-01-11 01:13:37 UTC (rev 23375) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2008-01-11 01:32:47 UTC (rev 23376) @@ -755,12 +755,13 @@ } } else { model->WriteAttrKillForegin(kAttrPoseInfo, kAttrPoseInfoForeign, - B_RAW_TYPE, 0, &poseInfo, sizeof(poseInfo)); - - if (desktop) + B_RAW_TYPE, 0, &poseInfo, sizeof(poseInfo))); + + if (desktop) { model->WriteAttrKillForegin(kAttrExtendedPoseInfo, kAttrExtendedPoseInfoForegin, B_RAW_TYPE, 0, extendedPoseInfo, extendedPoseInfoSize); + } } delete [] (char *)extendedPoseInfo; @@ -2541,6 +2542,8 @@ } } else { ASSERT(model->IsNodeOpen()); + time_t now = time(NULL); + for (int32 count = 10; count >= 0; count--) { if (!model->Node()) break; @@ -2558,9 +2561,9 @@ // pose info to properly place the icon if (ViewMode() == kListMode) break; - + const StatStruct *stat = model->StatBuf(); - if (stat->st_crtime != stat->st_mtime) + if (stat->st_crtime < now - 5) break; // PRINT(("retrying to read pose info for %s, %d\n", model->Name(), count)); From marcusoverhagen at mail.berlios.de Fri Jan 11 02:33:11 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Fri, 11 Jan 2008 02:33:11 +0100 Subject: [Haiku-commits] r23377 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801110133.m0B1XBE1006137@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-11 02:33:10 +0100 (Fri, 11 Jan 2008) New Revision: 23377 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23377&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c Log: fix bugs exposed by ASSERT Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-11 01:32:47 UTC (rev 23376) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-11 01:33:10 UTC (rev 23377) @@ -120,9 +120,9 @@ // we cannot copy sense directly as sense buffer may be too small scsi_set_sense(&sense, request); - ASSERT(sizeof(*request->ccb->sense) == SCSI_MAX_SENSE_SIZE); + ASSERT(sizeof(request->ccb->sense) == SCSI_MAX_SENSE_SIZE); - sense_len = min(sizeof(*request->ccb->sense), sizeof(sense)); + sense_len = min(sizeof(request->ccb->sense), sizeof(sense)); memcpy(request->ccb->sense, &sense, sense_len); request->ccb->sense_resid = SCSI_MAX_SENSE_SIZE - sense_len; @@ -131,7 +131,7 @@ // device sense gets reset once it's read ata_request_clear_sense(request); - ASSERT(request->ccb->subsys_status == SCSI_REQ_CMP_ERR); + ASSERT(request->ccb->subsys_status == SCSI_REQ_CMP_ERR | SCSI_AUTOSNS_VALID); ASSERT(request->ccb->device_status == SCSI_STATUS_CHECK_CONDITION); } } From mmu_man at mail.berlios.de Fri Jan 11 02:33:32 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 02:33:32 +0100 Subject: [Haiku-commits] r23378 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801110133.m0B1XWMW006180@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 02:33:32 +0100 (Fri, 11 Jan 2008) New Revision: 23378 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23378&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: I need Mediach() Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-11 01:33:10 UTC (rev 23377) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-11 01:33:32 UTC (rev 23378) @@ -67,7 +67,7 @@ #define Tickcal() bios(6) #define Getbpb(dev) (struct tosbpb *)bios(7, (uint16)dev) #define Bcostat(dev) bios(8, (uint16)dev) -//#define Mediach() bios(9, ) +#define Mediach(dev) bios(9, (int16)dev) #define Drvmap() (uint32)bios(10) #define Kbshift(mode) bios(11, (uint16)mode) From mmu_man at mail.berlios.de Fri Jan 11 02:41:39 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 02:41:39 +0100 Subject: [Haiku-commits] r23379 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801110141.m0B1fd8d006846@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 02:41:37 +0100 (Fri, 11 Jan 2008) New Revision: 23379 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23379&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp Log: Buildable boot drive support, not sure it works. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp 2008-01-11 01:33:32 UTC (rev 23378) +++ haiku/trunk/src/system/boot/platform/atari_m68k/devices.cpp 2008-01-11 01:41:37 UTC (rev 23379) @@ -12,6 +12,7 @@ #include +#include "Handle.h" #include "toscalls.h" //#define TRACE_DEVICES @@ -30,7 +31,7 @@ #define SCRATCH_SIZE (2*4096) static uint8 gScratchBuffer[4096]; -static const uint16 kParametersSizeVersion1 = 0x1a; +static const uint16 kParametersSizeVersion1 = sizeof(struct tosbpb); static const uint16 kParametersSizeVersion2 = 0x1e; static const uint16 kParametersSizeVersion3 = 0x42; @@ -145,18 +146,24 @@ static status_t +read_bpb(uint8 drive, struct tosbpb *bpb) +{ + struct tosbpb *p; + p = Getbpb(drive); + memcpy(bpb, p, sizeof(struct tosbpb)); + /* Getbpb is buggy so we must force a media change */ + //XXX: docs seems to assume we should loop until it works + Mediach(drive); + return B_OK; +} + +static status_t get_drive_parameters(uint8 drive, drive_parameters *parameters) { - struct bios_regs regs; - regs.eax = BIOS_GET_DRIVE_PARAMETERS; - regs.edx = drive; - regs.es = 0; - regs.edi = 0; // guard against faulty BIOS, see Ralf Brown's interrupt list - call_bios(0x13, ®s); + status_t err; + err = read_bpb(drive, ¶meters->bpb); - if ((regs.flags & CARRY_FLAG) != 0 || (regs.ecx & 0x3f) == 0) - return B_ERROR; - +#if 0 // fill drive_parameters structure with useful values parameters->parameters_size = kParametersSizeVersion1; parameters->flags = 0; @@ -167,11 +174,12 @@ parameters->sectors = parameters->cylinders * parameters->heads * parameters->sectors_per_track; parameters->bytes_per_sector = 512; - +#endif return B_OK; } +#if 0 /** parse EDD 3.0 drive path information */ static status_t @@ -250,8 +258,8 @@ return B_OK; } +#endif - static off_t get_next_check_sum_offset(int32 index, off_t maxSize) { @@ -387,7 +395,7 @@ { int32 map; uint8 driveID; - uint8 driveCount; + uint8 driveCount = 0; if (sBlockDevicesAdded) return B_OK; @@ -410,6 +418,7 @@ } devicesList->Add(drive); + driveCount++; if (drive->FillIdentifier() != B_OK) identifierMissing = true; @@ -444,6 +453,15 @@ } //XXX: check size + if (get_drive_parameters(fHandle, &fParameters) != B_OK) { + dprintf("getting drive parameters for: %u failed!\n", fHandle); + return; + } + fBlockSize = 512; + fSize = fParameters.sectors * fBlockSize; + fHasParameters = false; + +#if 0 if (get_ext_drive_parameters(driveID, &fParameters) != B_OK) { // old style CHS support @@ -476,6 +494,7 @@ fLBA = true; fHasParameters = true; } +#endif } @@ -564,6 +583,7 @@ status_t BlockHandle::FillIdentifier() { +#if 0 if (HasParameters()) { // try all drive_parameters versions, beginning from the most informative @@ -595,22 +615,12 @@ fIdentifier.device.unknown.check_sums[i].offset = -1; fIdentifier.device.unknown.check_sums[i].sum = 0; } +#endif return B_ERROR; } -status_t -BlockHandle::ReadBPB(struct tosbpb *bpb) -{ - struct tosbpb *p; - p = Getbpb(fHandle); - memcpy(bpb, p, sizeof(struct tosbpb)); - /* Getbpb is buggy so we must force a media change */ - //XXX: docs seems to assume we should loop until it works - Mediach(fHandle); - return B_OK; -} // #pragma mark - @@ -681,7 +691,9 @@ { BlockHandle *drive = (BlockHandle *)device; +#if 0 check_cd_boot(drive); +#endif gKernelArgs.boot_volume.SetInt64("boot drive number", drive->DriveID()); gKernelArgs.boot_volume.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE, From mmu_man at mail.berlios.de Fri Jan 11 02:46:06 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 02:46:06 +0100 Subject: [Haiku-commits] r23380 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801110146.m0B1k6D1007361@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 02:46:05 +0100 (Fri, 11 Jan 2008) New Revision: 23380 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23380&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: Needed header. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-11 01:41:37 UTC (rev 23379) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-11 01:46:05 UTC (rev 23380) @@ -9,6 +9,8 @@ #ifndef _TOSCALLS_H #define _TOSCALLS_H +#include + #ifdef __cplusplus extern "C" { #endif From mmu_man at mail.berlios.de Fri Jan 11 02:48:20 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 02:48:20 +0100 Subject: [Haiku-commits] r23381 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801110148.m0B1mK2M007451@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 02:48:19 +0100 (Fri, 11 Jan 2008) New Revision: 23381 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23381&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/start.c Log: Start code I'll work on tomorrow^Wtoday. Added: haiku/trunk/src/system/boot/platform/atari_m68k/start.c =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/start.c 2008-01-11 01:46:05 UTC (rev 23380) +++ haiku/trunk/src/system/boot/platform/atari_m68k/start.c 2008-01-11 01:48:19 UTC (rev 23381) @@ -0,0 +1,135 @@ +/* + * Copyright 2003-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include +#include +#include +#include +#include + +#include + +#include "console.h" +#include "cpu.h" +#include "mmu.h" +#include "keyboard.h" +#include "toscalls.h" + + +#define HEAP_SIZE 65536 + +// GCC defined globals +extern void (*__ctor_list)(void); +extern void (*__ctor_end)(void); +extern uint8 __bss_start; +extern uint8 _end; + +extern int main(stage2_args *args); +void _start(void); + + +uint32 sBootOptions; + + +static void +clear_bss(void) +{ + memset(&__bss_start, 0, &_end - &__bss_start); +} + + +static void +call_ctors(void) +{ + void (**f)(void); + + for (f = &__ctor_list; f < &__ctor_end; f++) { + (**f)(); + } +} + + +uint32 +platform_boot_options(void) +{ +#if 0 + if (!gKernelArgs.fb.enabled) + sBootOptions |= check_for_boot_keys(); +#endif + return sBootOptions; +} + + +void +platform_start_kernel(void) +{ + static struct kernel_args *args = &gKernelArgs; + // something goes wrong when we pass &gKernelArgs directly + // to the assembler inline below - might be a bug in GCC + // or I don't see something important... + addr_t stackTop = gKernelArgs.cpu_kstack[0].start + gKernelArgs.cpu_kstack[0].size; + + smp_init_other_cpus(); + serial_cleanup(); + mmu_init_for_kernel(); + smp_boot_other_cpus(); + + dprintf("kernel entry at %lx\n", gKernelArgs.kernel_image.elf_header.e_entry); + + asm("movl %0, %%eax; " // move stack out of way + "movl %%eax, %%esp; " + : : "m" (stackTop)); + asm("pushl $0x0; " // we're the BSP cpu (0) + "pushl %0; " // kernel args + "pushl $0x0;" // dummy retval for call to main + "pushl %1; " // this is the start address + "ret; " // jump. + : : "g" (args), "g" (gKernelArgs.kernel_image.elf_header.e_entry)); + + panic("kernel returned!\n"); +} + + +void +platform_exit(void) +{ + // reset the system using the keyboard controller + out8(0xfe, 0x64); +} + + +void +_start(void) +{ + stage2_args args; + + asm("cld"); // Ain't nothing but a GCC thang. + asm("fninit"); // initialize floating point unit + + clear_bss(); + call_ctors(); + // call C++ constructors before doing anything else + + args.heap_size = HEAP_SIZE; + + //serial_init(); + console_init(); + cpu_init(); + mmu_init(); + + // wait a bit to give the user the opportunity to press a key + spin(750000); + + // reading the keyboard doesn't seem to work in graphics mode (maybe a bochs problem) + sBootOptions = check_for_boot_keys(); + //if (sBootOptions & BOOT_OPTION_DEBUG_OUTPUT) + serial_enable(); + + //apm_init(); + //smp_init(); + main(&args); +} + From mmlr at mail.berlios.de Fri Jan 11 02:58:01 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 11 Jan 2008 02:58:01 +0100 Subject: [Haiku-commits] r23382 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200801110158.m0B1w1uW007980@sheep.berlios.de> Author: mmlr Date: 2008-01-11 02:58:01 +0100 (Fri, 11 Jan 2008) New Revision: 23382 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23382&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/ehci.h Log: * Add support for low/full speed interrupt transfers over USB 2.0 hubs * Actually enable the periodic schedule so that any interrupts work over EHCI For those who wait for OHCI: You can now attach your USB 1.1 mouse or keyboard to a USB 2.0 hub and it should work. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-01-11 01:48:19 UTC (rev 23381) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-01-11 01:58:01 UTC (rev 23382) @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007, Haiku Inc. All rights reserved. + * Copyright 2006-2008, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -295,11 +295,13 @@ for (int32 i = 1; i < 11; i++) { fInterruptEntries[i].queue_head.next_phy = firstPhysical; fInterruptEntries[i].queue_head.next_log = firstLogical; + fInterruptEntries[i].queue_head.prev_log = NULL; } // terminate the first entry firstLogical->next_phy = EHCI_QH_TERMINATE; firstLogical->next_log = NULL; + firstLogical->prev_log = NULL; // allocate a queue head that will always stay in the async frame list fAsyncQueueHead = CreateQueueHead(); @@ -356,7 +358,7 @@ uint32 frameListSize = (ReadOpReg(EHCI_USBCMD) >> EHCI_USBCMD_FLS_SHIFT) & EHCI_USBCMD_FLS_MASK; WriteOpReg(EHCI_USBCMD, ReadOpReg(EHCI_USBCMD) | EHCI_USBCMD_RUNSTOP - | EHCI_USBCMD_ASENABLE /*| EHCI_USBCMD_PSENABLE*/ + | EHCI_USBCMD_ASENABLE | EHCI_USBCMD_PSENABLE | (frameListSize << EHCI_USBCMD_FLS_SHIFT) | (2 << EHCI_USBCMD_ITC_SHIFT)); @@ -458,7 +460,7 @@ #endif if (pipe->Type() & USB_OBJECT_INTERRUPT_PIPE) - result = LinkInterruptQueueHead(queueHead, pipe->Interval()); + result = LinkInterruptQueueHead(queueHead, pipe); else result = LinkQueueHead(queueHead); @@ -1210,9 +1212,6 @@ | EHCI_QH_CHARS_TOGGLE; queueHead->endpoint_caps = (1 << EHCI_QH_CAPS_MULT_SHIFT); - if (pipe->Type() & USB_OBJECT_INTERRUPT_PIPE) - queueHead->endpoint_caps |= (0xff << EHCI_QH_CAPS_ISM_SHIFT); - if (pipe->Speed() != USB_SPEED_HIGHSPEED) { if (pipe->Type() & USB_OBJECT_CONTROL_PIPE) queueHead->endpoint_chars |= EHCI_QH_CHARS_CONTROL; @@ -1257,11 +1256,29 @@ status_t -EHCI::LinkInterruptQueueHead(ehci_qh *queueHead, uint8 interval) +EHCI::LinkInterruptQueueHead(ehci_qh *queueHead, Pipe *pipe) { if (!Lock()) return B_ERROR; + uint8 interval = pipe->Interval(); + if (pipe->Speed() == USB_SPEED_HIGHSPEED) { + // Allow interrupts to be scheduled on each possible micro frame. + queueHead->endpoint_caps |= (0xff << EHCI_QH_CAPS_ISM_SHIFT); + } else { + // As we do not yet support FSTNs to correctly reference low/full + // speed interrupt transfers, we simply put them into the 1 interval + // queue. This way we ensure that we reach them on every micro frame + // and can do the corresponding start/complete split transactions. + // ToDo: use FSTNs to correctly link non high speed interrupt transfers + interval = 1; + + // For now we also force start splits to be in micro frame 0 and + // complete splits to be in micro frame 2, 3 and 4. + queueHead->endpoint_caps |= (0x01 << EHCI_QH_CAPS_ISM_SHIFT); + queueHead->endpoint_caps |= (0x1c << EHCI_QH_CAPS_SCM_SHIFT); + } + // this should not happen if (interval < 1) interval = 1; @@ -1273,9 +1290,11 @@ interval = 11; ehci_qh *interruptQueue = &fInterruptEntries[interval - 1].queue_head; + queueHead->next_phy = interruptQueue->next_phy; queueHead->next_log = interruptQueue->next_log; - queueHead->next_phy = interruptQueue->next_phy; queueHead->prev_log = interruptQueue; + if (interruptQueue->next_log) + ((ehci_qh *)interruptQueue->next_log)->prev_log = queueHead; interruptQueue->next_log = queueHead; interruptQueue->next_phy = queueHead->this_phy | EHCI_QH_TYPE_QH; @@ -1292,9 +1311,14 @@ ehci_qh *prevHead = (ehci_qh *)queueHead->prev_log; ehci_qh *nextHead = (ehci_qh *)queueHead->next_log; - prevHead->next_phy = queueHead->next_phy | EHCI_QH_TYPE_QH; - prevHead->next_log = queueHead->next_log; - nextHead->prev_log = queueHead->prev_log; + if (prevHead) { + prevHead->next_phy = queueHead->next_phy | EHCI_QH_TYPE_QH; + prevHead->next_log = queueHead->next_log; + } + + if (nextHead) + nextHead->prev_log = queueHead->prev_log; + queueHead->next_phy = fAsyncQueueHead->this_phy | EHCI_QH_TYPE_QH; queueHead->prev_log = NULL; Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.h 2008-01-11 01:48:19 UTC (rev 23381) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.h 2008-01-11 01:58:01 UTC (rev 23382) @@ -80,7 +80,7 @@ status_t LinkQueueHead(ehci_qh *queueHead); status_t LinkInterruptQueueHead(ehci_qh *queueHead, - uint8 interval); + Pipe *pipe); status_t UnlinkQueueHead(ehci_qh *queueHead, ehci_qh **freeList); From mmlr at mail.berlios.de Fri Jan 11 03:21:49 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 11 Jan 2008 03:21:49 +0100 Subject: [Haiku-commits] r23383 - haiku/trunk/src/kits/tracker Message-ID: <200801110221.m0B2LnQU010509@sheep.berlios.de> Author: mmlr Date: 2008-01-11 03:21:47 +0100 (Fri, 11 Jan 2008) New Revision: 23383 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23383&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp Log: Fix syntax error. Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2008-01-11 01:58:01 UTC (rev 23382) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2008-01-11 02:21:47 UTC (rev 23383) @@ -755,7 +755,7 @@ } } else { model->WriteAttrKillForegin(kAttrPoseInfo, kAttrPoseInfoForeign, - B_RAW_TYPE, 0, &poseInfo, sizeof(poseInfo))); + B_RAW_TYPE, 0, &poseInfo, sizeof(poseInfo)); if (desktop) { model->WriteAttrKillForegin(kAttrExtendedPoseInfo, From axeld at mail.berlios.de Fri Jan 11 11:46:38 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 11 Jan 2008 11:46:38 +0100 Subject: [Haiku-commits] r23384 - haiku/trunk/src/kits/tracker Message-ID: <200801111046.m0BAkcv1029293@sheep.berlios.de> Author: axeld Date: 2008-01-11 11:46:37 +0100 (Fri, 11 Jan 2008) New Revision: 23384 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23384&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp Log: Files that were created in the future (time zone issues, or whatever) shouldn't be regarded recent either. Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2008-01-11 02:21:47 UTC (rev 23383) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2008-01-11 10:46:37 UTC (rev 23384) @@ -2563,7 +2563,7 @@ break; const StatStruct *stat = model->StatBuf(); - if (stat->st_crtime < now - 5) + if (stat->st_crtime < now - 5 || stat->st_crtime > now) break; // PRINT(("retrying to read pose info for %s, %d\n", model->Name(), count)); From mmu_man at mail.berlios.de Fri Jan 11 12:14:02 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 12:14:02 +0100 Subject: [Haiku-commits] r23385 - in haiku/trunk/src/system/libroot/posix: . unistd Message-ID: <200801111114.m0BBE2Lg031824@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 12:14:02 +0100 (Fri, 11 Jan 2008) New Revision: 23385 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23385&view=rev Added: haiku/trunk/src/system/libroot/posix/pwd_query.c Modified: haiku/trunk/src/system/libroot/posix/Jamfile haiku/trunk/src/system/libroot/posix/unistd/usergroup.c Log: Old code I wrote that implements multiuser the same way R5 did as a hidden feature... Worked quite well in latest zeta, so it's already tested :) Modified: haiku/trunk/src/system/libroot/posix/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/Jamfile 2008-01-11 10:46:37 UTC (rev 23384) +++ haiku/trunk/src/system/libroot/posix/Jamfile 2008-01-11 11:14:02 UTC (rev 23385) @@ -3,6 +3,11 @@ UsePrivateHeaders [ FDirName syslog_daemon ] ; UseHeaders $(TARGET_PRIVATE_KERNEL_HEADERS) : true ; +if $(HAIKU_ENABLE_MULTIUSER) = 1 { + PWD_BACKEND = pwd_query.c ; +} else { + PWD_BACKEND = pwd.c grp.c ; +} MergeObject posix_main.o : assert.c dlfcn.c @@ -10,10 +15,9 @@ errno.c fnmatch.c glob.c - grp.c inttypes.c poll.c - pwd.c + $(PWD_BACKEND) syslog.cpp termios.c utime.c Added: haiku/trunk/src/system/libroot/posix/pwd_query.c =================================================================== --- haiku/trunk/src/system/libroot/posix/pwd_query.c 2008-01-11 10:46:37 UTC (rev 23384) +++ haiku/trunk/src/system/libroot/posix/pwd_query.c 2008-01-11 11:14:02 UTC (rev 23385) @@ -0,0 +1,641 @@ + +/* + * This is a reimplementation of the BeOS R5 query-based multi-user system. + * (c) 2005, Fran?ois Revol. + * provided under the MIT licence + */ + +//#ifdef REAL_MULTIUSER +#if 1 + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Some notes. + * Users are stored in an fs node (not necessarily a regular file, + * that could be a dir, even the user's home dir, + * though we should be careful as they are owned by users. + */ + + +#define GR_MAX_NAME 32 + +#define PW_MAX_NAME 32 +#define PW_MAX_DIR B_PATH_NAME_LENGTH +#define PW_MAX_GECOS 128 +#define PW_MAX_PASSWD 32 +#define PW_MAX_SHELL B_PATH_NAME_LENGTH + +/* should be more than enough :) */ +#define GRBUFFSZ (GR_MAX_NAME + 2) +#define PWBUFFSZ (PW_MAX_NAME + PW_MAX_DIR + PW_MAX_GECOS + PW_MAX_PASSWD + PW_MAX_SHELL + 4) + + +/* attribute names we use to store groups & users. */ +/* pets nm & strings */ + +static const char *B_GR_GID = "sys:group:gid"; +static const char *B_GR_NAME = "sys:group:name"; +//static const char *B_GR_PASSWD = "sys:group:passwd"; + +static const char *B_PW_DIR = "sys:user:dir"; +static const char *B_PW_GECOS = "sys:user:fullname"; +static const char *B_PW_GID = "sys:user:gid"; +static const char *B_PW_NAME = "sys:user:name"; +static const char *B_PW_PASSWD = "sys:user:passwd"; +static const char *B_PW_SHELL = "sys:user:shell"; +static const char *B_PW_UID = "sys:user:uid"; + +/* queries */ +static const char *Q_GR_ALL = "sys:group:gid>-1"; +static const char *QT_GR_GID = "sys:group:gid==%d"; +static const char *QT_GR_NAM = "sys:group:name==\"%s\""; +static const char *Q_PW_ALL = "sys:user:uid>-1"; +static const char *QT_PW_UID = "sys:user:uid==%d"; +static const char *QT_PW_NAM = "sys:user:name==\"%s\""; + +extern void __init_pwd_stuff(void); +extern void __fini_pwd_stuff(void); + +static char *default_gr_members[] = { /*"baron",*/ NULL }; + +static dev_t boot_device; + +/* TLS stuff */ + +static int32 pw_tls_id; + +typedef struct pw_tls { + DIR *grent_query; + DIR *pwent_query; + + int gridx; + int pwidx; + + char grfile[B_PATH_NAME_LENGTH+1]; /* current group's cached file path */ + char pwfile[B_PATH_NAME_LENGTH+1]; /* current user's cached file path */ + + struct group grent; + char grbuff[GRBUFFSZ]; /* XXX: merge with pwbuff ? */ + + struct passwd pwent; + char pwbuff[PWBUFFSZ]; +} pw_tls_t; + +struct pw_tls *get_pw_tls(void) +{ + pw_tls_t *p = (pw_tls_t *)tls_get(pw_tls_id); + PRINT(("%s()\n", __FUNCTION__)); + + if (!p) { + p = (pw_tls_t *)malloc(sizeof(pw_tls_t)); + if (!p) + return NULL; + memset(p, 0, sizeof(pw_tls_t)); + p->grent_query = NULL; + p->pwent_query = NULL; + tls_set(pw_tls_id, p); + } + return p; +} + +/* fill the path from the dirent and open() */ +int dentopen(struct dirent *dent, char *path) +{ + int err; + PRINT(("%s({%ld, %Ld, %ld, %Ld, %s}, )\n", __FUNCTION__, dent->d_pdev, dent->d_pino, dent->d_dev, dent->d_ino, dent->d_name)); + dent->d_dev = boot_device; + err = get_path_for_dirent(dent, path, B_PATH_NAME_LENGTH); + if ((err < 0) || (path[0] != '/')) { + errno = err; + return -1; + } + PRINT(("%s: open(%s)\n", __FUNCTION__, path)); + return open(path, O_RDONLY); +} + +/* group stuff */ + +int fill_grent_default(struct group *gbuf) +{ + PRINT(("%s()\n", __FUNCTION__)); + gbuf->gr_gid = 1000; + gbuf->gr_name = gbuf->gr_gid?"users":"wheel"; + gbuf->gr_passwd = ""; + gbuf->gr_mem = default_gr_members; + return 0; +} + +int fill_grent_from_fd(int fd, struct group *gbuf, char *buf, size_t buflen) +{ + size_t left; + ssize_t len; + left = buflen; + len = fs_read_attr(fd, B_GR_GID, B_INT32_TYPE, 0LL, &gbuf->gr_gid, sizeof(gid_t)); + if (len < 0) + return fill_grent_default(gbuf); + PRINT(("%s: got gid\n", __FUNCTION__)); + gbuf->gr_passwd = ""; + gbuf->gr_mem = default_gr_members; + + if (left < GR_MAX_NAME + 1) + return ERANGE; + len = fs_read_attr(fd, B_GR_NAME, B_STRING_TYPE, 0LL, buf, GR_MAX_NAME); + if (len < 0) + return fill_grent_default(gbuf); + gbuf->gr_name = buf; + buf[len] = '\0'; + left -= len + 1; + buf += len + 1; + PRINT(("%s: got name\n", __FUNCTION__)); + return 0; +} + +void setgrent(void) +{ + pw_tls_t *p; + p = get_pw_tls(); + PRINT(("%s()\n", __FUNCTION__)); + if (p->grent_query) /* clumsy apps */ + fs_close_query(p->grent_query); + p->grent_query = fs_open_query(boot_device, Q_GR_ALL, 0); + PRINT(("pwq: %p\n", p->grent_query)); + p->gridx = 0; +} + +void endgrent(void) +{ + pw_tls_t *p; + PRINT(("%s()\n", __FUNCTION__)); + p = get_pw_tls(); + + if (p->grent_query) + fs_close_query(p->grent_query); + p->grent_query = NULL; + p->gridx = -1; +} + + +/* this conforms to the linux getgrent_r (there are several protos for that one... crap) */ +/* note the FILE * based version is not supported as it makes no sense here */ +int getgrent_r(struct group *gbuf, char *buf, size_t buflen, struct group **gbufp) +{ + pw_tls_t *p; + int err; + int fd; + struct dirent *dent; + PRINT(("%s()\n", __FUNCTION__)); + p = get_pw_tls(); + if (!p) + return ENOMEM; +PRINT(("getgrent_r: grq = %p, idx = %d\n", p->grent_query, p->gridx)); + if (!p->grent_query) + setgrent(); /* y0u clumsy app! */ + if (!p->grent_query) + return EIO; /* something happened... */ + errno = 0; + dent = fs_read_query(p->grent_query); + *gbufp = NULL; + if (!dent) { + /* found nothing on first iteration ? */ + if (p->gridx == 0) { + if (fill_grent_default(gbuf) < 0) + return -1; + *gbufp = gbuf; + p->gridx++; + } + return 0; + } + fd = dentopen(dent, p->grfile); + if (fd < B_OK) + return errno?errno:-1; + err = fill_grent_from_fd(fd, gbuf, buf, buflen); + PRINT(("%s: fill_grent_from_fd = %d\n", __FUNCTION__, err)); + close(fd); + if (err) + return err; + p->gridx++; + *gbufp = gbuf; + return 0; +} + +struct group *getgrent(void) +{ + pw_tls_t *p; + struct group *ent; + int err; + PRINT(("%s()\n", __FUNCTION__)); + p = get_pw_tls(); + if (!p) { + /* we are really bork */ + errno = ENOMEM; + return NULL; + } + err = getgrent_r(&p->grent, p->grbuff, GRBUFFSZ, &ent); + if (err < 0) { + errno = err; + return NULL; + } + if (!ent) + return NULL; + PRINT(("getgrent(); returning entry for %s\n", ent->gr_name)); + return ent; +} + +/* by gid */ +struct group *getgrgid(gid_t gid) +{ + struct dirent *dent; + pw_tls_t *p; + DIR *query; + int err; + int fd; + + PRINT(("%s()\n", __FUNCTION__)); + p = get_pw_tls(); + if (!p) { + /* we are really bork */ + errno = ENOMEM; + return NULL; + } + + /* reusing path */ + sprintf(p->grfile, QT_GR_GID, gid); + query = fs_open_query(boot_device, p->grfile, 0); + PRINT(("q: %p\n", query)); + if (!query) + return NULL; + + dent = fs_read_query(query); + if (!dent) { + fs_close_query(query); + return NULL; + } + fd = dentopen(dent, p->grfile); + fs_close_query(query); + if (fd < B_OK) + return NULL; + err = fill_grent_from_fd(fd, &p->grent, p->grbuff, GRBUFFSZ); + PRINT(("%s: fill_grent_from_fd = %d\n", __FUNCTION__, err)); + close(fd); + if (err) + return NULL; + return &p->grent; + +} + +/* by name */ +struct group *getgrnam(const char *name) +{ + struct dirent *dent; + pw_tls_t *p; + DIR *query; + int err; + int fd; + + PRINT(("%s()\n", __FUNCTION__)); + p = get_pw_tls(); + if (!p) { + /* we are really bork */ + errno = ENOMEM; + return NULL; + } + + if (!name || strlen(name) > GR_MAX_NAME) { + errno = EINVAL; + return NULL; + } + /* reusing path */ + sprintf(p->grfile, QT_GR_NAM, name); + query = fs_open_query(boot_device, p->grfile, 0); + PRINT(("q: %p\n", query)); + if (!query) + return NULL; + + dent = fs_read_query(query); + if (!dent) { + fs_close_query(query); + return NULL; + } + fd = dentopen(dent, p->grfile); + fs_close_query(query); + if (fd < B_OK) + return NULL; + err = fill_grent_from_fd(fd, &p->grent, p->grbuff, GRBUFFSZ); + PRINT(("%s: fill_grent_from_fd = %d\n", __FUNCTION__, err)); + close(fd); + if (err) + return NULL; + return &p->grent; + +} + + +/* user stuff */ + +int fill_pwent_default(struct passwd *pwbuf) +{ + PRINT(("%s()\n", __FUNCTION__)); + return ENOENT; /* hmm no we don't exist! */ + pwbuf->pw_gid = 1000; + pwbuf->pw_uid = 1000; + pwbuf->pw_name = "baron"; + pwbuf->pw_passwd = "*"; + pwbuf->pw_dir = "/var/tmp"; + pwbuf->pw_shell = "/bin/false"; + pwbuf->pw_gecos = "Unknown User"; + return 0; +} + +int fill_pwent_from_fd(int fd, struct passwd *pwbuf, char *buf, size_t buflen) +{ + ssize_t left; + ssize_t len; + PRINT(("%s()\n", __FUNCTION__)); + left = buflen; + if (left <= 0) + return ERANGE; + + len = fs_read_attr(fd, B_PW_GID, B_INT32_TYPE, 0LL, &pwbuf->pw_gid, sizeof(gid_t)); + if (len < 0) + return fill_pwent_default(pwbuf); + PRINT(("%s: got gid\n", __FUNCTION__)); + + len = fs_read_attr(fd, B_PW_UID, B_INT32_TYPE, 0LL, &pwbuf->pw_uid, sizeof(uid_t)); + if (len < 0) + return fill_pwent_default(pwbuf); + PRINT(("%s: got uid\n", __FUNCTION__)); + + if (left < PW_MAX_NAME + 1) + return ERANGE; + len = fs_read_attr(fd, B_PW_NAME, B_STRING_TYPE, 0LL, buf, PW_MAX_NAME); + if (len < 0) + return fill_pwent_default(pwbuf); + pwbuf->pw_name = buf; + buf[len] = '\0'; + left -= len + 1; + buf += len + 1; + PRINT(("%s: got name\n", __FUNCTION__)); + + if (left < PW_MAX_DIR + 1) + return ERANGE; + len = fs_read_attr(fd, B_PW_DIR, B_STRING_TYPE, 0LL, buf, PW_MAX_DIR); + if (len < 0) + return fill_pwent_default(pwbuf); + pwbuf->pw_dir = buf; + buf[len] = '\0'; + left -= len + 1; + buf += len + 1; + PRINT(("%s: got dir\n", __FUNCTION__)); + + if (left < PW_MAX_SHELL + 1) + return ERANGE; + len = fs_read_attr(fd, B_PW_SHELL, B_STRING_TYPE, 0LL, buf, PW_MAX_SHELL); + if (len < 0) + return fill_pwent_default(pwbuf); + pwbuf->pw_shell = buf; + buf[len] = '\0'; + left -= len + 1; + buf += len + 1; + PRINT(("%s: got shell\n", __FUNCTION__)); + + if (left < PW_MAX_GECOS + 1) + return ERANGE; + len = fs_read_attr(fd, B_PW_GECOS, B_STRING_TYPE, 0LL, buf, PW_MAX_GECOS); + if (len < 0) + return fill_pwent_default(pwbuf); + pwbuf->pw_gecos = buf; + buf[len] = '\0'; + left -= len + 1; + buf += len + 1; + PRINT(("%s: got gecos\n", __FUNCTION__)); + + if (left < PW_MAX_PASSWD + 1) + return ERANGE; + len = fs_read_attr(fd, B_PW_PASSWD, B_STRING_TYPE, 0LL, buf, PW_MAX_PASSWD); + if (len < 0) { + buf[0] = '*'; /* no pass set */ + len = 1; + } + pwbuf->pw_passwd = buf; + buf[len] = '\0'; + left -= len + 1; + buf += len + 1; + PRINT(("%s: got passwd\n", __FUNCTION__)); + + return 0; +} + + + +void setpwent(void) +{ + pw_tls_t *p; + p = get_pw_tls(); + PRINT(("%s()\n", __FUNCTION__)); + if (p->pwent_query) /* clumsy apps */ + fs_close_query(p->pwent_query); + p->pwent_query = fs_open_query(boot_device, Q_PW_ALL, 0); + PRINT(("pwq: %p\n", p->pwent_query)); + p->pwidx = 0; +} + +void endpwent(void) +{ + pw_tls_t *p; + PRINT(("%s()\n", __FUNCTION__)); + p = get_pw_tls(); + + if (p->pwent_query) + fs_close_query(p->pwent_query); + p->pwent_query = NULL; + p->pwidx = -1; +} + + +/* this conforms to the linux getpwent_r (there are several protos for that one... crap) */ +/* note the FILE * based version is not supported as it makes no sense here */ +int getpwent_r(struct passwd *pwbuf, char *buf, size_t buflen, struct passwd **pwbufp) +{ + pw_tls_t *p; + int err; + int fd; + struct dirent *dent; + PRINT(("%s()\n", __FUNCTION__)); + p = get_pw_tls(); + if (!p) + return ENOMEM; +PRINT(("getpwent_r: pwq = %p, idx = %d\n", p->pwent_query, p->pwidx)); + if (!p->pwent_query) + setpwent(); /* y0u clumsy app! */ + if (!p->pwent_query) + return EIO; /* something happened... */ + errno = 0; + dent = fs_read_query(p->pwent_query); + *pwbufp = NULL; + if (!dent) { + /* found nothing on first iteration ? */ + if (p->pwidx == 0) { + if (fill_pwent_default(pwbuf) < 0) + return -1; + *pwbufp = pwbuf; + p->pwidx++; + } + return 0; + } + fd = dentopen(dent, p->pwfile); + if (fd < B_OK) + return errno?errno:-1; + err = fill_pwent_from_fd(fd, pwbuf, buf, buflen); + PRINT(("%s: fill_pwent_from_fd = %d\n", __FUNCTION__, err)); + close(fd); + if (err) + return err; + p->pwidx++; + *pwbufp = pwbuf; + return 0; +} + +struct passwd *getpwent(void) +{ + pw_tls_t *p; + struct passwd *ent; + int err; + PRINT(("%s()\n", __FUNCTION__)); + p = get_pw_tls(); + if (!p) { + /* we are really bork */ + errno = ENOMEM; + return NULL; + } + err = getpwent_r(&p->pwent, p->pwbuff, PWBUFFSZ, &ent); + if (err < 0) { + errno = err; + return NULL; + } + if (!ent) + return NULL; + PRINT(("getpwent(); returning entry for %s\n", ent->pw_name)); + return ent; +} + +/* by gid */ +struct passwd *getpwuid(uid_t uid) +{ + struct dirent *dent; + pw_tls_t *p; + DIR *query; + int err; + int fd; + + PRINT(("%s(%d)\n", __FUNCTION__, uid)); + p = get_pw_tls(); + if (!p) { + /* we are really bork */ + errno = ENOMEM; + return NULL; + } + + /* reusing path */ + sprintf(p->pwfile, QT_PW_UID, uid); + PRINT(("%s: query(%s)\n", __FUNCTION__, p->pwfile)); + query = fs_open_query(boot_device, p->pwfile, 0); + PRINT(("q: %p\n", query)); + if (!query) + return NULL; + + dent = fs_read_query(query); + if (!dent) { + fs_close_query(query); + return NULL; + } + fd = dentopen(dent, p->pwfile); + fs_close_query(query); + if (fd < B_OK) + return NULL; + err = fill_pwent_from_fd(fd, &p->pwent, p->pwbuff, PWBUFFSZ); + PRINT(("%s: fill_pwent_from_fd = %d\n", __FUNCTION__, err)); + close(fd); + if (err) + return NULL; + return &p->pwent; + +} + +/* by name */ +struct passwd *getpwnam(const char *name) +{ + struct dirent *dent; + pw_tls_t *p; + DIR *query; + int err; + int fd; + + PRINT(("%s(%s)\n", __FUNCTION__, name)); + p = get_pw_tls(); + if (!p) { + /* we are really bork */ + errno = ENOMEM; + return NULL; + } + + if (!name || strlen(name) > PW_MAX_NAME) { + errno = EINVAL; + return NULL; + } + /* reusing path */ + sprintf(p->pwfile, QT_PW_NAM, name); + PRINT(("%s: query(%s)\n", __FUNCTION__, p->pwfile)); + query = fs_open_query(boot_device, p->pwfile, 0); + PRINT(("q: %p\n", query)); + if (!query) + return NULL; + + dent = fs_read_query(query); + if (!dent) { + fs_close_query(query); + return NULL; + } + PRINT(("%s: dentopen()\n", __FUNCTION__)); + fd = dentopen(dent, p->pwfile); + fs_close_query(query); + if (fd < B_OK) + return NULL; + err = fill_pwent_from_fd(fd, &p->pwent, p->pwbuff, PWBUFFSZ); + PRINT(("%s: fill_pwent_from_fd = %d\n", __FUNCTION__, err)); + close(fd); + if (err) + return NULL; + return &p->pwent; + +} + + +void __init_pwd_stuff(void) +//void _multiuser_init(void) +{ + /* dev_t for the boot volume */ + boot_device = dev_for_path("/boot"); + /* get us an id for holding thread-specific data */ + pw_tls_id = tls_allocate(); +} + +void __fini_pwd_stuff(void) +//void _multiuser_fini(void) +{ + +} + + +#endif /* REAL_MULTIUSER */ + Modified: haiku/trunk/src/system/libroot/posix/unistd/usergroup.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/usergroup.c 2008-01-11 10:46:37 UTC (rev 23384) +++ haiku/trunk/src/system/libroot/posix/unistd/usergroup.c 2008-01-11 11:14:02 UTC (rev 23385) @@ -10,6 +10,7 @@ #include #include #include +#include // ToDo: implement the user/group functions for real! @@ -100,17 +101,27 @@ } -char * -getlogin(void) +char *getlogin() { - return "baron"; + struct passwd *pw; + pw = getpwuid(getuid()); + if (pw) + return pw->pw_name; + errno = ENOMEM; + return NULL; } -int -getlogin_r(char *name, size_t nameSize) +int getlogin_r(char *name, size_t nameSize) { - strlcpy(name, "baron", nameSize); - return 0; + struct passwd *pw; + pw = getpwuid(getuid()); + if (pw && (nameSize > 32/*PW_MAX_NAME*/)) { + memset(name, 0, nameSize); + strlcpy(name, pw->pw_name, 32/*PW_MAX_NAME*/); + return B_OK; + } + return ENOMEM; } + From mmu_man at mail.berlios.de Fri Jan 11 12:22:47 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 12:22:47 +0100 Subject: [Haiku-commits] r23386 - haiku/trunk/src/apps/terminal Message-ID: <200801111122.m0BBMlCM000045@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 12:22:47 +0100 (Fri, 11 Jan 2008) New Revision: 23386 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23386&view=rev Modified: haiku/trunk/src/apps/terminal/TermApp.cpp Log: Fix build under BeOS. Modified: haiku/trunk/src/apps/terminal/TermApp.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermApp.cpp 2008-01-11 11:14:02 UTC (rev 23385) +++ haiku/trunk/src/apps/terminal/TermApp.cpp 2008-01-11 11:22:47 UTC (rev 23386) @@ -79,9 +79,15 @@ // Install a SIGCHLD signal handler, so that we will be notified, when // a shell exits. struct sigaction action; +#ifdef __HAIKU__ action.sa_handler = (sighandler_t)_SigChildHandler; +#else + action.sa_handler = (__signal_func_ptr)_SigChildHandler; +#endif sigemptyset(&action.sa_mask); +#ifdef SA_NODEFER action.sa_flags = SA_NODEFER; +#endif action.sa_userdata = this; if (sigaction(SIGCHLD, &action, NULL) < 0) { fprintf(stderr, "sigaction() failed: %s\n", strerror(errno)); From jackburton at mail.berlios.de Fri Jan 11 12:35:00 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Fri, 11 Jan 2008 12:35:00 +0100 Subject: [Haiku-commits] r23387 - haiku/trunk/src/kits/interface Message-ID: <200801111135.m0BBZ02V011594@sheep.berlios.de> Author: jackburton Date: 2008-01-11 12:34:53 +0100 (Fri, 11 Jan 2008) New Revision: 23387 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23387&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp Log: BMenu::_SelectNextItem() also opens the menu if we're inside a menubar. That way menubars are navigable via keyboard. There are still glitches, but menu keyboard navigation works now. Minor optimization: cache the value of CountItems() instead of calling it multiple times. Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-11 11:22:47 UTC (rev 23386) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-11 11:34:53 UTC (rev 23387) @@ -2159,7 +2159,10 @@ if (nextItem == NULL) return false; - _SelectItem(nextItem, false); + bool openMenu = false; + if (dynamic_cast(this) != NULL) + openMenu = true; + _SelectItem(nextItem, openMenu); return true; } @@ -2167,18 +2170,12 @@ BMenuItem * BMenu::_NextItem(BMenuItem *item, bool forward) const { - /*if (item == NULL) { - if (forward) - return ItemAt(CountItems() - 1); - - return ItemAt(0); - } -*/ // go to next item, and skip over disabled items such as separators int32 index = fItems.IndexOf(item); if (index < 0) index = 0; + const int32 numItems = fItems.CountItems(); int32 startIndex = index; do { if (forward) @@ -2188,8 +2185,8 @@ // cycle through menu items if (index < 0) - index = CountItems() - 1; - else if(index >= fItems.CountItems()) + index = numItems - 1; + else if (index >= numItems) index = 0; } while (!ItemAt(index)->IsEnabled() && index != startIndex); From mmlr at mail.berlios.de Fri Jan 11 12:37:30 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 11 Jan 2008 12:37:30 +0100 Subject: [Haiku-commits] r23388 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200801111137.m0BBbUew016314@sheep.berlios.de> Author: mmlr Date: 2008-01-11 12:37:18 +0100 (Fri, 11 Jan 2008) New Revision: 23388 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23388&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c Log: * Deactivate the device when both the transfers and the clear feature fail * Some restructuring and cleanup This keeps the input_server from polling a removed device continuously. Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-11 11:34:53 UTC (rev 23387) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-11 11:37:18 UTC (rev 23388) @@ -613,32 +613,38 @@ /* cancelled: device is unplugged */ return status; } -#if 1 + status = usb->clear_feature(device->ept->handle, USB_FEATURE_ENDPOINT_HALT); - if (status != B_OK) + if (status != B_OK) { DPRINTF_ERR((MY_ID "clear_feature() error %d\n", (int)status)); -#endif - } else { - /* got a report */ + // probably the device was removed and we just didn't get the + // removed notification yet. + device->active = false; + return status; + } + + return device->bus_status; + } + + /* got a report */ #if 0 - uint32 i; - char linbuf [256]; - uint8 *buffer = device->buffer; + uint32 i; + char linbuf [256]; + uint8 *buffer = device->buffer; - for (i = 0; i < device->total_report_size; i++) - sprintf (&linbuf[i*3], "%02X ", buffer [i]); - DPRINTF_INFO ((MY_ID "input report: %s\n", linbuf)); + for (i = 0; i < device->total_report_size; i++) + sprintf (&linbuf[i*3], "%02X ", buffer [i]); + DPRINTF_INFO ((MY_ID "input report: %s\n", linbuf)); #endif - device->timestamp = system_time(); + device->timestamp = system_time(); - if (device->is_keyboard) { - interpret_kb_buffer(device); - memcpy(device->last_buffer, device->buffer, device->total_report_size); - } else - interpret_mouse_buffer(device); - } + if (device->is_keyboard) { + interpret_kb_buffer(device); + memcpy(device->last_buffer, device->buffer, device->total_report_size); + } else + interpret_mouse_buffer(device); - return status; + return B_OK; } @@ -910,8 +916,7 @@ static status_t -hid_device_control(driver_cookie *cookie, uint32 op, - void *arg, size_t len) +hid_device_control(driver_cookie *cookie, uint32 op, void *arg, size_t length) { status_t err = B_ERROR; hid_device_info *device; @@ -967,7 +972,7 @@ case KB_SET_LEDS: set_leds(device, (uint8 *)arg); - break; + return B_OK; } } else { switch (op) { @@ -1006,11 +1011,12 @@ default: /* not implemented */ - break; + return B_ERROR; } } - return err; + /* shouldn't get here */ + return B_ERROR; } @@ -1112,6 +1118,7 @@ free_device_names(); } + /*! device names are generated dynamically */ @@ -1153,4 +1160,3 @@ return &hooks; } - From stefano.ceccherini at gmail.com Fri Jan 11 12:40:59 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Fri, 11 Jan 2008 12:40:59 +0100 Subject: [Haiku-commits] r23343 - haiku/trunk/src/kits/interface In-Reply-To: <200801102128.m0ALSvSO012674@post.webmailer.de> References: <200801102128.m0ALSvSO012674@post.webmailer.de> Message-ID: <894b9700801110340j196f755dl33c3fc5edb381d67@mail.gmail.com> 2008/1/10, Axel D?rfler : > From: Stefano Ceccherini > > > IsModal() now includes also the kMenuWindowLook. Fixes bug #1269. Please > > > review. > > Looks good to me. > > > This would mean there's some bug in the focus mechanism in the > > app_server, wouldn't it ? > > Axel, since you wrote that part, do you have any idea ? > > After having looked at the method in question (Desktop::KeyboardEventTarget()), I had an idea, indeed :-) > It's fixed in r23356. > Thanks! What's weird, though, is that I thought only views could receive mouse events, and not windows. IOW: since menus are detached from the menuwindow before they are hidden, I thought that would be enough to prevent them keeping focus. From jackburton at mail.berlios.de Fri Jan 11 13:08:22 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Fri, 11 Jan 2008 13:08:22 +0100 Subject: [Haiku-commits] r23389 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200801111208.m0BC8MUR014949@sheep.berlios.de> Author: jackburton Date: 2008-01-11 13:08:21 +0100 (Fri, 11 Jan 2008) New Revision: 23389 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23389&view=rev Modified: haiku/trunk/headers/os/interface/Menu.h haiku/trunk/src/kits/interface/Menu.cpp Log: Close the whole menu hierarchy when invoking an item via keyboard. Added a TODO comment. Modified: haiku/trunk/headers/os/interface/Menu.h =================================================================== --- haiku/trunk/headers/os/interface/Menu.h 2008-01-11 11:37:18 UTC (rev 23388) +++ haiku/trunk/headers/os/interface/Menu.h 2008-01-11 12:08:21 UTC (rev 23389) @@ -234,7 +234,7 @@ // private methods called by BWindow int State(BMenuItem** _item = NULL) const; void InvokeItem(BMenuItem* item, bool now = false); - void QuitTracking(); + void QuitTracking(bool onlyThis = true); static menu_info sMenuInfo; static bool sAltAsCommandKey; Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-11 11:37:18 UTC (rev 23388) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-11 12:08:21 UTC (rev 23389) @@ -868,8 +868,10 @@ case B_ENTER: case B_SPACE: - if (fSelected) + if (fSelected) { InvokeItem(fSelected); + QuitTracking(false); + } break; case B_ESCAPE: @@ -1974,6 +1976,8 @@ return; // Do the "selected" animation + // TODO: Doesn't work. This is supposed to highlight + // and dehighlight the item, works on beos but not on haiku. if (!item->Submenu() && LockLooper()) { snooze(50000); item->Select(true); @@ -2379,15 +2383,19 @@ void -BMenu::QuitTracking() +BMenu::QuitTracking(bool onlyThis) { _SelectItem(NULL); if (BMenuBar *menuBar = dynamic_cast(this)) menuBar->_RestoreFocus(); fChosenItem = NULL; + fState = MENU_STATE_CLOSED; - fState = MENU_STATE_CLOSED; + // Close the whole menu hierarchy + if (!onlyThis && _IsStickyMode()) + _SetStickyMode(false); + _Hide(); } From mmu_man at mail.berlios.de Fri Jan 11 13:12:58 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 13:12:58 +0100 Subject: [Haiku-commits] r23390 - haiku/trunk/src/apps/codycam Message-ID: <200801111212.m0BCCwqA017511@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 13:12:58 +0100 (Fri, 11 Jan 2008) New Revision: 23390 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23390&view=rev Modified: haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp haiku/trunk/src/apps/codycam/SpawningUploadClient.h Log: cleaner and safer getpty() I wrote long ago. Modified: haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp 2008-01-11 12:08:21 UTC (rev 23389) +++ haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp 2008-01-11 12:12:58 UTC (rev 23390) @@ -40,29 +40,20 @@ bool SpawningUploadClient::SpawnCommand() { + char ptypath[20]; + char ttypath[20]; //XXX: should use a system-provided TerminalCommand class BString shellcmd = "exec"; const char *args[] = { "/bin/sh", "-c", NULL, NULL }; - char path[20]; - int pty; - for (pty = 0; pty < 0x50; pty++) { - int fd; - sprintf(path, "/dev/pt/%c%1x", 'p' + pty / 16, pty & 0x0f); - printf("trying %s\n", path); - fd = open(path, O_RDWR); - if (fd < 0) - continue; - fPty = fd; - break; - } - if (fPty < 0) - return false; - sprintf(path, "/dev/tt/%c%1x", 'p' + pty / 16, pty & 0x0f); - shellcmd << " 0<" << path; - shellcmd << " 1>" << path; + int pty = getpty(ptypath, ttypath); + if (pty < 0) + return B_ERROR; + + shellcmd << " 0<" << ttypath; + shellcmd << " 1>" << ttypath; shellcmd += " 2>&1"; shellcmd << " ; "; - shellcmd << "export TTY=" << path << "; "; // BeOS hack + shellcmd << "export TTY=" << ttypath << "; "; // BeOS hack shellcmd << "export LC_ALL=C; export LANG=C; "; shellcmd << "exec "; shellcmd << fCommand.c_str(); @@ -112,6 +103,32 @@ } +int +SpawningUploadClient::getpty(char *pty, char *tty) +{ + static const char major[] = "pqrs"; + static const char minor[] = "0123456789abcdef"; + uint32 i, j; + int32 fd = -1; + + for (i = 0; i < sizeof(major); i++) + { + for (j = 0; j < sizeof(minor); j++) + { + sprintf(pty, "/dev/pt/%c%c", major[i], minor[j]); + sprintf(tty, "/dev/tt/%c%c", major[i], minor[j]); + fd = open(pty, O_RDONLY|O_NOCTTY); + if (fd >= 0) + { + return fd; + } + } + } + + return fd; +} + + /* the rest is empty */ Modified: haiku/trunk/src/apps/codycam/SpawningUploadClient.h =================================================================== --- haiku/trunk/src/apps/codycam/SpawningUploadClient.h 2008-01-11 12:08:21 UTC (rev 23389) +++ haiku/trunk/src/apps/codycam/SpawningUploadClient.h 2008-01-11 12:12:58 UTC (rev 23390) @@ -35,6 +35,7 @@ ssize_t SendCommand(const char *cmd); ssize_t ReadReply(BString *to); virtual status_t ParseReply(); +int getpty(char *pty, char *tty); int InputPipe() const { return fPty; }; int OutputPipe() const { return fPty; }; From mmu_man at mail.berlios.de Fri Jan 11 14:05:06 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 14:05:06 +0100 Subject: [Haiku-commits] r23391 - in haiku/trunk/src/system/libroot/posix: . unistd Message-ID: <200801111305.m0BD565U026199@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 14:05:06 +0100 (Fri, 11 Jan 2008) New Revision: 23391 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23391&view=rev Modified: haiku/trunk/src/system/libroot/posix/pwd.c haiku/trunk/src/system/libroot/posix/pwd_query.c haiku/trunk/src/system/libroot/posix/unistd/usergroup.c Log: Fix the build for you mortal monousers. Actually getlogin didn't belong to usergroup.c in the first place anyway. And definitely not to the kernel. Modified: haiku/trunk/src/system/libroot/posix/pwd.c =================================================================== --- haiku/trunk/src/system/libroot/posix/pwd.c 2008-01-11 12:12:58 UTC (rev 23390) +++ haiku/trunk/src/system/libroot/posix/pwd.c 2008-01-11 13:05:06 UTC (rev 23391) @@ -132,3 +132,28 @@ *_result = passwd; return 0; } + + +char *getlogin() +{ + struct passwd *pw; + pw = getpwuid(getuid()); + if (pw) + return pw->pw_name; + errno = ENOMEM; + return NULL; +} + + +int getlogin_r(char *name, size_t nameSize) +{ + struct passwd *pw; + pw = getpwuid(getuid()); + if (pw && (nameSize > 32/*PW_MAX_NAME*/)) { + memset(name, 0, nameSize); + strlcpy(name, pw->pw_name, 32/*PW_MAX_NAME*/); + return B_OK; + } + return ENOMEM; +} + Modified: haiku/trunk/src/system/libroot/posix/pwd_query.c =================================================================== --- haiku/trunk/src/system/libroot/posix/pwd_query.c 2008-01-11 12:12:58 UTC (rev 23390) +++ haiku/trunk/src/system/libroot/posix/pwd_query.c 2008-01-11 13:05:06 UTC (rev 23391) @@ -621,6 +621,30 @@ } +char *getlogin() +{ + struct passwd *pw; + pw = getpwuid(getuid()); + if (pw) + return pw->pw_name; + errno = ENOMEM; + return NULL; +} + + +int getlogin_r(char *name, size_t nameSize) +{ + struct passwd *pw; + pw = getpwuid(getuid()); + if (pw && (nameSize > 32/*PW_MAX_NAME*/)) { + memset(name, 0, nameSize); + strlcpy(name, pw->pw_name, 32/*PW_MAX_NAME*/); + return B_OK; + } + return ENOMEM; +} + + void __init_pwd_stuff(void) //void _multiuser_init(void) { Modified: haiku/trunk/src/system/libroot/posix/unistd/usergroup.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/usergroup.c 2008-01-11 12:12:58 UTC (rev 23390) +++ haiku/trunk/src/system/libroot/posix/unistd/usergroup.c 2008-01-11 13:05:06 UTC (rev 23391) @@ -100,28 +100,3 @@ return EPERM; } - -char *getlogin() -{ - struct passwd *pw; - pw = getpwuid(getuid()); - if (pw) - return pw->pw_name; - errno = ENOMEM; - return NULL; -} - - -int getlogin_r(char *name, size_t nameSize) -{ - struct passwd *pw; - pw = getpwuid(getuid()); - if (pw && (nameSize > 32/*PW_MAX_NAME*/)) { - memset(name, 0, nameSize); - strlcpy(name, pw->pw_name, 32/*PW_MAX_NAME*/); - return B_OK; - } - return ENOMEM; -} - - From marcusoverhagen at mail.berlios.de Fri Jan 11 14:25:39 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Fri, 11 Jan 2008 14:25:39 +0100 Subject: [Haiku-commits] r23392 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801111325.m0BDPd7W029371@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-11 14:25:38 +0100 (Fri, 11 Jan 2008) New Revision: 23392 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23392&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c Log: Replaced most true and false with named flags. Made all timeouts use bigtime_t. Cleanup. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-11 13:05:06 UTC (rev 23391) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-11 13:25:38 UTC (rev 23392) @@ -82,12 +82,12 @@ /** busy-wait for device * set - bits of status register that must be set * cleared - bits of status register that must be cleared - * check_err - abort if error bit is set + * flags - 0 or ATA_CHECK_ERROR_BIT abort if error bit is set * timeout - waiting timeout */ status_t ata_wait(ide_bus_info *bus, uint8 set, uint8 cleared, - bool check_err, bigtime_t timeout) + ata_flags flags, bigtime_t timeout) { bigtime_t startTime = system_time(); bigtime_t elapsedTime = 0; @@ -99,7 +99,7 @@ for (;;) { status = bus->controller->get_altstatus(bus->channel_cookie); - if (check_err && (status & ide_status_err) != 0) + if ((flags & ATA_CHECK_ERROR_BIT) && (status & ide_status_err) != 0) return B_ERROR; if ((status & set) == set && (status & cleared) == 0) { @@ -112,7 +112,7 @@ if (elapsedTime > timeout) return B_TIMED_OUT; - if (elapsedTime < 100000) + if (elapsedTime < 150000) spin(1); else snooze(3000); @@ -124,7 +124,7 @@ status_t ata_wait_for_drq(ide_bus_info *bus) { - return ata_wait(bus, ide_status_drq, 0, true, 10000000); + return ata_wait(bus, ide_status_drq, 0, ATA_CHECK_ERROR_BIT, 10000000); } @@ -132,7 +132,7 @@ status_t ata_wait_for_drqdown(ide_bus_info *bus) { - return ata_wait(bus, 0, ide_status_drq, true, 1000000); + return ata_wait(bus, 0, ide_status_drq, ATA_CHECK_ERROR_BIT, 1000000); } @@ -140,7 +140,7 @@ status_t ata_wait_for_drdy(ide_bus_info *bus) { - return ata_wait(bus, ide_status_drdy, ide_status_bsy, false, 5000000); + return ata_wait(bus, ide_status_drdy, ide_status_bsy, 0, 5000000); } @@ -148,7 +148,7 @@ status_t ata_wait_idle(ide_bus_info *bus) { - return ata_wait(bus, 0, ide_status_bsy | ide_status_drq, false, 20000); + return ata_wait(bus, 0, ide_status_bsy | ide_status_drq, 0, 20000); } @@ -158,21 +158,19 @@ ata_pio_wait_drdy(ide_device_info *device) { ASSERT(device->bus->state == ata_state_pio); - return ata_wait(device->bus, ide_status_drdy, ide_status_bsy, false, device->pio_timeout); + return ata_wait(device->bus, ide_status_drdy, ide_status_bsy, 0, device->pio_timeout); } status_t -ata_send_command(ide_device_info *device, ata_request *request, bool need_drdy, - uint32 timeout, ata_bus_state new_state) +ata_send_command(ide_device_info *device, ata_request *request, ata_flags flags, bigtime_t timeout) { ide_bus_info *bus = device->bus; ASSERT((device->tf_param_mask & ide_mask_command) == 0); - ASSERT(new_state == ata_state_pio || new_state == ata_state_dma); ASSERT(bus->state == ata_state_busy); - ASSERT(new_state == ata_state_pio); // XXX only pio for now + ASSERT((flags & ATA_DMA_TRANSFER) == 0); // XXX only pio for now FLOW("ata_send_command: %d:%d, request %p, ccb %p, tf %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n", device->target_id, device->is_device1, @@ -183,7 +181,7 @@ device->tf.raw.r[9], device->tf.raw.r[10], device->tf.raw.r[11]); // disable Interrupts for PIO transfers - if (new_state == ata_state_pio) { + if ((flags & ATA_DMA_TRANSFER) == 0) { if (bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3 | ide_devctrl_nien) != B_OK) goto err; } @@ -198,7 +196,7 @@ return B_ERROR; } - if (need_drdy && (bus->controller->get_altstatus(bus->channel_cookie) & ide_status_drdy) == 0) { + if ((flags & ATA_DRDY_REQUIRED) && (bus->controller->get_altstatus(bus->channel_cookie) & ide_status_drdy) == 0) { TRACE("drdy not set\n"); ata_request_set_status(request, SCSI_SEQUENCE_FAIL); return B_ERROR; @@ -212,7 +210,8 @@ IDE_LOCK(bus); - if (new_state == ata_state_dma) { + if (flags & ATA_DMA_TRANSFER) { + // enable interrupt if (bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3) != B_OK) goto err_clearint; } @@ -223,9 +222,9 @@ ASSERT(bus->state == ata_state_busy); - bus->state = new_state; + bus->state = (flags & ATA_DMA_TRANSFER) ? ata_state_dma : ata_state_pio; if (request) - request->device->pio_timeout = timeout * 1000; + request->device->pio_timeout = timeout; IDE_UNLOCK(bus); @@ -242,19 +241,113 @@ return B_ERROR; } + +/** check result of ATA command + * drdy_required - true if drdy must be set by device + * error_mask - bits to be checked in error register + * is_write - true, if command was a write command + */ + status_t -ata_read_status(ide_device_info *device, uint8 *status) +ata_finish_command(ide_device_info *device, ata_request *request, ata_flags flags, uint8 errorMask) { - status_t result = device->bus->controller->read_command_block_regs(device->bus->channel_cookie, &device->tf, ide_mask_status); - if (status) - *status = device->tf.read.status; +#if 0 + ide_bus_info *bus = device->bus; + uint8 status; + + // check IRQ timeout + if (bus->sync_wait_timeout) { + bus->sync_wait_timeout = false; + + device->subsys_status = SCSI_CMD_TIMEOUT; + return false; + } + + status = bus->controller->get_altstatus(bus->channel_cookie); + + // if device is busy, other flags are indeterminate + if ((status & ide_status_bsy) != 0) { + device->subsys_status = SCSI_SEQUENCE_FAIL; + return false; + } + + if (drdy_required && ((status & ide_status_drdy) == 0)) { + device->subsys_status = SCSI_SEQUENCE_FAIL; + return false; + } + + if ((status & ide_status_err) != 0) { + uint8 error; + + if (bus->controller->read_command_block_regs(bus->channel_cookie, + &device->tf, ide_mask_error) != B_OK) { + device->subsys_status = SCSI_HBA_ERR; + return false; + } + + error = device->tf.read.error & error_mask; + + if ((error & ide_error_icrc) != 0) { + set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_LUN_COM_CRC); + return false; + } + + if (is_write) { + if ((error & ide_error_wp) != 0) { + set_sense(device, SCSIS_KEY_DATA_PROTECT, SCSIS_ASC_WRITE_PROTECTED); + return false; + } + } else { + if ((error & ide_error_unc) != 0) { + set_sense(device, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_UNREC_READ_ERR); + return false; + } + } + + if ((error & ide_error_mc) != 0) { + // XXX proper sense key? + set_sense(device, SCSIS_KEY_UNIT_ATTENTION, SCSIS_ASC_MEDIUM_CHANGED); + return false; + } + + if ((error & ide_error_idnf) != 0) { + // XXX strange error code, don't really know what it means + set_sense(device, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_RANDOM_POS_ERROR); + return false; + } + + if ((error & ide_error_mcr) != 0) { + // XXX proper sense key? + set_sense(device, SCSIS_KEY_UNIT_ATTENTION, SCSIS_ASC_REMOVAL_REQUESTED); + return false; + } + + if ((error & ide_error_nm) != 0) { + set_sense(device, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_NO_MEDIUM); + return false; + } + + if ((error & ide_error_abrt) != 0) { + set_sense(device, SCSIS_KEY_ABORTED_COMMAND, SCSIS_ASC_NO_SENSE); + return false; + } + + // either there was no error bit set or it was masked out + set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_INTERNAL_FAILURE); + return false; + } +#endif + return B_OK; } status_t -ata_finish_command(ide_device_info *device) +ata_read_status(ide_device_info *device, uint8 *status) { - return B_OK; + status_t result = device->bus->controller->read_command_block_regs(device->bus->channel_cookie, &device->tf, ide_mask_status); + if (status) + *status = device->tf.read.status; + return result; } @@ -296,8 +389,8 @@ ata_select_device(bus, 0); // dprintf("altstatus device 0: %x\n", controller->get_altstatus(channel)); - // wait up to 31 seconds for busy to clear, abort when error is set - status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); + // wait up to 31 seconds for busy to clear + status = ata_wait(bus, 0, ide_status_bsy, 0, 31000000); if (status != B_OK) { dprintf("ATA: reset_bus: timeout\n"); goto error; @@ -326,8 +419,8 @@ ata_select_device(bus, 1); // dprintf("altstatus device 1: %x\n", controller->get_altstatus(channel)); - // wait up to 31 seconds for busy to clear, abort when error is set - status = ata_wait(bus, 0, ide_status_bsy, false, 31000000); + // wait up to 31 seconds for busy to clear + status = ata_wait(bus, 0, ide_status_bsy, 0, 31000000); if (status != B_OK) { dprintf("ATA: reset_bus: timeout\n"); goto error; @@ -410,7 +503,7 @@ { ide_device_info *device = request->device; uint32 timeout = request->ccb->timeout > 0 ? - request->ccb->timeout : IDE_STD_TIMEOUT; + request->ccb->timeout * 1000 : IDE_STD_TIMEOUT; SHOW_FLOW0(3, ""); @@ -657,7 +750,8 @@ uint64 pos, size_t length, bool write) { ide_bus_info *bus = device->bus; - uint32 timeout; + ata_flags flags = 0; + bigtime_t timeout; // make a copy first as settings may get changed by user during execution request->is_write = write; @@ -681,11 +775,13 @@ goto err_setup; // if no timeout is specified, use standard - timeout = request->ccb->timeout > 0 ? - request->ccb->timeout : IDE_STD_TIMEOUT; + timeout = request->ccb->timeout > 0 ? request->ccb->timeout * 1000 : IDE_STD_TIMEOUT; - if (ata_send_command(device, request, !device->is_atapi, timeout, - request->uses_dma ? ata_state_dma : ata_state_pio) != B_OK) + if (device->is_atapi) + flags |= ATA_DRDY_REQUIRED; + if (request->uses_dma) + flags |= ATA_DMA_TRANSFER; + if (ata_send_command(device, request, flags, timeout) != B_OK) goto err_send; if (request->uses_dma) { @@ -916,7 +1012,7 @@ device->tf.write.features = feature; device->tf.write.command = IDE_CMD_SET_FEATURES; - if (!send_command(device, NULL, true, 1, ata_state_sync_waiting)) + if (!send_command(device, NULL, ATA_DRDY_REQUIRED, 1000000)) return false; wait_for_sync(device->bus); @@ -952,7 +1048,7 @@ device->tf_param_mask = 0; device->tf.write.command = IDE_CMD_GET_MEDIA_STATUS; - if (!send_command(device, NULL, true, 15, ata_state_sync_waiting)) + if (!send_command(device, NULL, ATA_DRDY_REQUIRED, 15000000)) continue; if (check_output(device, true, @@ -1053,24 +1149,24 @@ status_t -ata_read_infoblock(ide_device_info *device, bool isAtapi) +ata_identify_device(ide_device_info *device, bool isAtapi) { ide_bus_info *bus = device->bus; - TRACE("ata_read_infoblock: bus %p, device %d, isAtapi %d\n", device->bus, device->is_device1, isAtapi); + TRACE("ata_identify_device: bus %p, device %d, isAtapi %d\n", device->bus, device->is_device1, isAtapi); ata_select(device); device->tf_param_mask = 0; - device->tf.write.command = isAtapi ? IDE_CMD_IDENTIFY_PACKET_DEVICE : IDE_CMD_IDENTIFY_DEVICE; + device->tf.write.command = isAtapi ? IDE_CMD_IDENTIFY_PACKET_DEVICE : IDE_CMD_IDENTIFY_DEVICE; - if (ata_send_command(device, NULL, isAtapi ? false : true, 20, ata_state_pio) != B_OK) { - TRACE("ata_read_infoblock: send_command failed\n"); + if (ata_send_command(device, NULL, isAtapi ? 0 : ATA_DRDY_REQUIRED, 20000000) != B_OK) { + TRACE("ata_identify_device: send_command failed\n"); goto error; } - if (ata_wait(bus, ide_status_drq, ide_status_bsy, true, 4000000) != B_OK) { - TRACE("ata_read_infoblock: wait failed\n"); + if (ata_wait(bus, ide_status_drq, ide_status_bsy, ATA_CHECK_ERROR_BIT, 4000000) != B_OK) { + TRACE("ata_identify_device: wait failed\n"); goto error; } @@ -1079,7 +1175,7 @@ sizeof(device->infoblock) / sizeof(uint16), false); if (ata_wait_for_drqdown(bus) != B_OK) { - TRACE("ata_read_infoblock: ata_wait_for_drqdown failed\n"); + TRACE("ata_identify_device: ata_wait_for_drqdown failed\n"); goto error; } @@ -1091,7 +1187,7 @@ bus->state = ata_state_busy; IDE_UNLOCK(bus); - TRACE("ata_read_infoblock: success\n"); + TRACE("ata_identify_device: success\n"); return B_OK; error: Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-11 13:05:06 UTC (rev 23391) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-11 13:25:38 UTC (rev 23392) @@ -131,7 +131,7 @@ // device sense gets reset once it's read ata_request_clear_sense(request); - ASSERT(request->ccb->subsys_status == SCSI_REQ_CMP_ERR | SCSI_AUTOSNS_VALID); + ASSERT(request->ccb->subsys_status == (SCSI_REQ_CMP_ERR | SCSI_AUTOSNS_VALID)); ASSERT(request->ccb->device_status == SCSI_STATUS_CHECK_CONDITION); } } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-11 13:05:06 UTC (rev 23391) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-11 13:25:38 UTC (rev 23392) @@ -356,7 +356,7 @@ SHOW_FLOW0(3, "3"); - if (!send_command(device, request, false, + if (!send_command(device, request, DRDY_NOT_REQUIRED, device->atapi.packet_irq_timeout, device->atapi.packet_irq ? ide_state_async_waiting : ide_state_accessing)) goto err_setup; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-11 13:05:06 UTC (rev 23391) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-11 13:25:38 UTC (rev 23392) @@ -159,7 +159,7 @@ { dprintf("ATA: scan_device\n"); - if (ata_read_infoblock(device, isAtapi) != B_OK) { + if (ata_identify_device(device, isAtapi) != B_OK) { dprintf("ATA: couldn't read infoblock for device %p\n", device); return B_ERROR; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-11 13:05:06 UTC (rev 23391) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-11 13:25:38 UTC (rev 23392) @@ -28,7 +28,7 @@ #include "wrapper.h" -#define IDE_STD_TIMEOUT 10 +#define IDE_STD_TIMEOUT 10000000 #define IDE_RELEASE_TIMEOUT 10000000 // number of timeouts before we disable DMA automatically @@ -118,14 +118,6 @@ } ide_device_info; -/*// state as stored in sim_state of scsi_ccb -typedef enum { - ide_request_normal = 0, // this must be zero as this is initial value - ide_request_start_autosense = 1, - ide_request_autosense = 2 -} ide_request_state;*/ - - // state of ide bus typedef enum { ata_state_idle, // not is using it @@ -135,6 +127,15 @@ } ata_bus_state; +typedef enum { + ATA_DRDY_REQUIRED = 0x01, + ATA_IS_WRITE = 0x02, +// ATA_PIO_TRANSFER = 0x04, + ATA_DMA_TRANSFER = 0x08, + ATA_CHECK_ERROR_BIT = 0x10 +} ata_flags; + + struct ide_bus_info { // controller @@ -193,16 +194,17 @@ void ata_select_device(ide_bus_info *bus, int device); void ata_select(ide_device_info *device); bool ata_is_device_present(ide_bus_info *bus, int device); -status_t ata_wait(ide_bus_info *bus, uint8 set, uint8 not_set, bool check_err, bigtime_t timeout); +status_t ata_wait(ide_bus_info *bus, uint8 set, uint8 not_set, ata_flags flags, bigtime_t timeout); status_t ata_wait_for_drq(ide_bus_info *bus); status_t ata_wait_for_drqdown(ide_bus_info *bus); status_t ata_wait_for_drdy(ide_bus_info *bus); status_t ata_pio_wait_drdy(ide_device_info *device); status_t ata_reset_bus(ide_bus_info *bus, bool *_devicePresent0, uint32 *_sigDev0, bool *_devicePresent1, uint32 *_sigDev1); status_t ata_reset_device(ide_device_info *device, bool *_devicePresent); -status_t ata_send_command(ide_device_info *device, ata_request *request, bool need_drdy, uint32 timeout, ata_bus_state new_state); -status_t ata_finish_command(ide_device_info *device); +status_t ata_send_command(ide_device_info *device, ata_request *request, ata_flags flags, bigtime_t timeout); +status_t ata_finish_command(ide_device_info *device, ata_request *request, ata_flags flags, uint8 errorMask); + bool check_rw_error(ide_device_info *device, ata_request *request); bool check_output(ide_device_info *device, bool drdy_required, int error_mask, bool is_write); @@ -213,7 +215,7 @@ void ata_exec_io(ide_device_info *device, ata_request *request); -status_t ata_read_infoblock(ide_device_info *device, bool isAtapi); +status_t ata_identify_device(ide_device_info *device, bool isAtapi); status_t configure_ata_device(ide_device_info *device); @@ -278,12 +280,7 @@ // sync.c // timeout in seconds (according to CAM) -void start_waiting(ide_bus_info *bus, uint32 timeout, int new_state); -void start_waiting_nolock(ide_bus_info *bus, uint32 timeout, int new_state); -void wait_for_sync(ide_bus_info *bus); -void cancel_irq_timeout(ide_bus_info *bus); - void ide_dpc(void *arg); void access_finished(ide_bus_info *bus, ide_device_info *device); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-11 13:05:06 UTC (rev 23391) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-11 13:25:38 UTC (rev 23392) @@ -230,16 +230,11 @@ device->tf_param_mask = 0; device->tf.write.command = IDE_CMD_GET_MEDIA_STATUS; - if (ata_send_command(device, request, true, 15, ata_state_pio) != B_OK) { + if (ata_send_command(device, request, ATA_DRDY_REQUIRED, 15) != B_OK) { return; } - if (ata_pio_wait_drdy(device) != B_OK) { - return; - } - - // bits ide_error_mcr | ide_error_mc | ide_error_wp are also valid // but not requested by TUR; ide_error_wp can safely be ignored, but // we don't want to loose media change (request) reports From mmu_man at mail.berlios.de Fri Jan 11 14:34:07 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 14:34:07 +0100 Subject: [Haiku-commits] r23393 - haiku/trunk/src/apps/codycam Message-ID: <200801111334.m0BDY7xT030374@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 14:34:06 +0100 (Fri, 11 Jan 2008) New Revision: 23393 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23393&view=rev Modified: haiku/trunk/src/apps/codycam/SftpClient.cpp haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp Log: * warning * save the fd so we can use it :) * open the pty read-write else it won't work... Modified: haiku/trunk/src/apps/codycam/SftpClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/SftpClient.cpp 2008-01-11 13:25:38 UTC (rev 23392) +++ haiku/trunk/src/apps/codycam/SftpClient.cpp 2008-01-11 13:34:06 UTC (rev 23393) @@ -62,7 +62,6 @@ SftpClient::PrintWorkingDir(string& dir) { bool rc = false; - int len; SendCommand("pwd\n"); BString reply; return rc; Modified: haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp 2008-01-11 13:25:38 UTC (rev 23392) +++ haiku/trunk/src/apps/codycam/SpawningUploadClient.cpp 2008-01-11 13:34:06 UTC (rev 23393) @@ -45,8 +45,8 @@ //XXX: should use a system-provided TerminalCommand class BString shellcmd = "exec"; const char *args[] = { "/bin/sh", "-c", NULL, NULL }; - int pty = getpty(ptypath, ttypath); - if (pty < 0) + fPty = getpty(ptypath, ttypath); + if (fPty < 0) return B_ERROR; shellcmd << " 0<" << ttypath; @@ -117,7 +117,7 @@ { sprintf(pty, "/dev/pt/%c%c", major[i], minor[j]); sprintf(tty, "/dev/tt/%c%c", major[i], minor[j]); - fd = open(pty, O_RDONLY|O_NOCTTY); + fd = open(pty, O_RDWR|O_NOCTTY); if (fd >= 0) { return fd; From stippi at mail.berlios.de Fri Jan 11 14:42:22 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 11 Jan 2008 14:42:22 +0100 Subject: [Haiku-commits] r23394 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200801111342.m0BDgLqF031541@sheep.berlios.de> Author: stippi Date: 2008-01-11 14:42:21 +0100 (Fri, 11 Jan 2008) New Revision: 23394 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23394&view=rev Modified: haiku/trunk/headers/os/interface/Region.h haiku/trunk/src/kits/interface/Region.cpp Log: * expose the XOR function for BRegions (for now called "ExclusiveInclude") which already existed in the region backend ported from XOrg Modified: haiku/trunk/headers/os/interface/Region.h =================================================================== --- haiku/trunk/headers/os/interface/Region.h 2008-01-11 13:34:06 UTC (rev 23393) +++ haiku/trunk/headers/os/interface/Region.h 2008-01-11 13:42:21 UTC (rev 23394) @@ -66,6 +66,8 @@ void IntersectWith(const BRegion* region); + void ExclusiveInclude(const BRegion* region); + private: friend class BDirectWindow; friend class BPrivate::ServerLink; Modified: haiku/trunk/src/kits/interface/Region.cpp =================================================================== --- haiku/trunk/src/kits/interface/Region.cpp 2008-01-11 13:34:06 UTC (rev 23393) +++ haiku/trunk/src/kits/interface/Region.cpp 2008-01-11 13:42:21 UTC (rev 23394) @@ -414,7 +414,7 @@ /*! \brief Modifies the region, so that it will contain just the area in common with the given BRegion. - \param region the BRegion to intersect to. + \param region the BRegion to intersect with. */ void BRegion::IntersectWith(const BRegion* region) @@ -429,6 +429,23 @@ // #pragma mark - +/*! \brief Modifies the region, so that it will contain just the area + which both regions do not have in common. + \param region the BRegion to exclusively include. +*/ +void +BRegion::ExclusiveInclude(const BRegion* region) +{ + BRegion result; + Support::XXorRegion(this, region, &result); + + _AdoptRegionData(result); +} + + +// #pragma mark - + + /*! \brief Takes over the data of a region and marks that region empty. \param region The region to adopt the data from. */ @@ -501,6 +518,7 @@ return true; } + clipping_rect BRegion::_Convert(const BRect& rect) const { From axeld at pinc-software.de Fri Jan 11 14:45:31 2008 From: axeld at pinc-software.de (=?iso-8859-1?q?=41=78=65=6c=20=44=f6=72=66=6c=65=72?=) Date: Fri, 11 Jan 2008 14:45:31 +0100 (MET) Subject: [Haiku-commits] r23343 - haiku/trunk/src/kits/interface Message-ID: <200801111345.m0BDjV0E023298@post.webmailer.de> From: Stefano Ceccherini > Thanks! > What's weird, though, is that I thought only views could receive mouse > events, and not windows. IOW: since menus are detached from the > menuwindow before they are hidden, I thought that would be enough to > prevent them keeping focus. One might think so, but focus is actually a window only thing from the app_server's POV. Mouse and keyboard events are supposed to show up in BWindow::DispatchMessage() and are then routed to its target (usually the view with focus) from there. But of course you can overwrite that and do it differently from there. Bye, Axel. From mmu_man at mail.berlios.de Fri Jan 11 15:01:19 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 15:01:19 +0100 Subject: [Haiku-commits] r23397 - haiku/trunk/src/system/kernel/arch/x86 Message-ID: <200801111401.m0BE1JZU000677@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 15:01:19 +0100 (Fri, 11 Jan 2008) New Revision: 23397 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23397&view=rev Modified: haiku/trunk/src/system/kernel/arch/x86/arch_commpage.cpp Log: Hi Ingo, I'm not the only one to break the build today :)) gcc4 fix. Modified: haiku/trunk/src/system/kernel/arch/x86/arch_commpage.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_commpage.cpp 2008-01-11 13:52:48 UTC (rev 23396) +++ haiku/trunk/src/system/kernel/arch/x86/arch_commpage.cpp 2008-01-11 14:01:19 UTC (rev 23397) @@ -60,7 +60,7 @@ static status_t initialize_commpage_syscall(void) { - void* syscallCode = &_user_syscall_int; + void* syscallCode = (void *)&_user_syscall_int; void* syscallCodeEnd = &_user_syscall_int_end; // check syscall @@ -71,7 +71,7 @@ dprintf("initialize_commpage_syscall(): sysenter/sysexit supported\n"); // the code to be used in userland - syscallCode = &_user_syscall_sysenter; + syscallCode = (void *)&_user_syscall_sysenter; syscallCodeEnd = &_user_syscall_sysenter_end; // tell all CPUs to init their sysenter/sysexit related registers From axeld at mail.berlios.de Fri Jan 11 15:04:54 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 11 Jan 2008 15:04:54 +0100 Subject: [Haiku-commits] r23398 - haiku/trunk/src/servers/app Message-ID: <200801111404.m0BE4snF001075@sheep.berlios.de> Author: axeld Date: 2008-01-11 15:04:53 +0100 (Fri, 11 Jan 2008) New Revision: 23398 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23398&view=rev Modified: haiku/trunk/src/servers/app/Desktop.cpp Log: Fixed two dirty region problems of the workspace switching code: * If two intersecting windows didn't change their position but their order, the dirty region wouldn't contain the region that would need to be updated because of that order change. This fixes bug #827. * When a hidden window was on the new workspace (but not on the old one), its region would be included in the dirty region, but shouldn't have been. This caused the app_server to update a larger region than necessary. Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2008-01-11 14:01:19 UTC (rev 23397) +++ haiku/trunk/src/servers/app/Desktop.cpp 2008-01-11 14:04:53 UTC (rev 23398) @@ -921,6 +921,9 @@ // show windows, and include them in the changed region - but only // those that were not visible before (or whose position changed) + WindowList windows(kWorkingList); + BList previousRegions; + for (WindowLayer* window = _Windows(index).FirstWindow(); window != NULL; window = window->NextWindow(index)) { BPoint position = window->Anchor(index).position; @@ -953,6 +956,17 @@ BPoint offset = position - window->Frame().LeftTop(); MoveWindowBy(window, offset.x, offset.y); // TODO: be a bit smarter than this... + } else { + // We need to remember the previous visible region of the + // window if they changed their order + BRegion* region = new (std::nothrow) + BRegion(window->VisibleRegion()); + if (region != NULL) { + if (previousRegions.AddItem(region)) + windows.AddWindow(window); + else + delete region; + } } } @@ -969,7 +983,7 @@ // send B_WORKSPACE_ACTIVATED message window->WorkspaceActivated(index, true); - if (window->InWorkspace(previousIndex) + if (window->InWorkspace(previousIndex) || window->IsHidden() || (window == fMouseEventWindow && fMouseEventWindow->IsNormal()) || (!window->IsNormal() && window->HasInSubset(fMouseEventWindow))) { // this window was visible before, and is already handled in the above loop @@ -979,14 +993,33 @@ dirty.Include(&window->VisibleRegion()); } + // Catch order changes in the new workspaces window list + int32 i = 0; + for (WindowLayer* window = windows.FirstWindow(); window != NULL; + window = window->NextWindow(kWorkingList), i++) { + BRegion* region = (BRegion*)previousRegions.ItemAt(i); + region->ExclusiveInclude(&window->VisibleRegion()); + dirty.Include(region); + delete region; + } + // Set new focus to the front window, but keep focus to a floating // window if still visible if (!_Windows(index).HasWindow(FocusWindow()) || !FocusWindow()->IsFloating()) SetFocusWindow(FrontWindow()); - _WindowChanged(NULL); + _WindowChanged(NULL); MarkDirty(dirty); +#if 0 + // Show the dirty regions of this workspace switch + if (GetDrawingEngine()->LockParallelAccess()) { + GetDrawingEngine()->FillRegion(dirty, (rgb_color){255, 0, 0}); + GetDrawingEngine()->UnlockParallelAccess(); + snooze(100000); + } +#endif + if (previousColor != fWorkspaces[fCurrentWorkspace].Color()) RedrawBackground(); } From korli at mail.berlios.de Fri Jan 11 15:17:18 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Fri, 11 Jan 2008 15:17:18 +0100 Subject: [Haiku-commits] r23399 - haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki Message-ID: <200801111417.m0BEHIkk001984@sheep.berlios.de> Author: korli Date: 2008-01-11 15:17:17 +0100 (Fri, 11 Jan 2008) New Revision: 23399 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23399&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/config.h haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.h haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/multi.c Log: style cleanup should fix detection of Audigy2 Value (it was trying to check the revision id instead of the device id) Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/config.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/config.h 2008-01-11 14:04:53 UTC (rev 23398) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/config.h 2008-01-11 14:17:17 UTC (rev 23399) @@ -49,9 +49,11 @@ #define TYPE_AUDIGY 0x01 #define TYPE_AUDIGY2 0x02 -#define TYPE_LIVE_5_1 0x04 +#define TYPE_AUDIGY2_VALUE 0x04 +#define TYPE_LIVE_5_1 0x08 #define IS_AUDIGY(x) ((x)->type & TYPE_AUDIGY) #define IS_AUDIGY2(x) ((x)->type & TYPE_AUDIGY2) +#define IS_AUDIGY2_VALUE(x) ((x)->type & TYPE_AUDIGY2_VALUE) #define IS_LIVE_5_1(x) ((x)->type & TYPE_LIVE_5_1) #endif Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c 2008-01-11 14:04:53 UTC (rev 23398) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c 2008-01-11 14:17:17 UTC (rev 23399) @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include "emuxki.h" @@ -227,7 +228,7 @@ static void emuxki_mem_delete(emuxki_mem *mem) { - if(mem->area > B_OK) + if (mem->area > B_OK) delete_area(mem->area); free(mem); } @@ -472,7 +473,7 @@ emuxki_dev *card = chan->voice->stream->card; uint8 chano = chan->num; - if(IS_AUDIGY(&card->config)) { + if (IS_AUDIGY(&card->config)) { emuxki_chan_write(&card->config, chano, 0x4c, 0); emuxki_chan_write(&card->config, chano, 0x4d, 0); emuxki_chan_write(&card->config, chano, 0x4e, 0); @@ -645,7 +646,7 @@ LOG(("voice->b16 = %#u\n", voice->b16)); LOG(("voice->sample_rate = %#lu\n", voice->sample_rate)); LOG(("voice->buffer = %#08x\n", voice->buffer)); - if(voice->buffer) { + if (voice->buffer) { LOG(("voice->buffer->ptbidx = %#u\n", voice->buffer->ptbidx)); LOG(("voice->buffer->log_base = %#08x\n", voice->buffer->log_base)); LOG(("voice->buffer->phy_base = %#08x\n", voice->buffer->phy_base)); @@ -773,16 +774,16 @@ if (voice->stereo) { switch(voice->stream->card->play_mode) { case 2: - if(voice->stream->nstereo == 1) { + if (voice->stream->nstereo == 1) { fxsend.a.dest = voice->voicenum * 2; fxsend.a.level = maxlevel; - } else if((voice->stream->nstereo == 2) || + } else if ((voice->stream->nstereo == 2) || ((voice->stream->nstereo == 3)&&(voice->voicenum < 2))) { fxsend.a.dest = voice->voicenum * 2; fxsend.a.level = maxlevel; - if(voice->voicenum > 1 - 1) + if (voice->voicenum > 1 - 1) fxsend.a.dest-=2; - } else if(voice->stream->nstereo == 3 && voice->voicenum > 1) { + } else if (voice->stream->nstereo == 3 && voice->voicenum > 1) { fxsend.a.dest = 0x0; fxsend.a.level = maxlevel / 2; fxsend.b.dest = 0x1; @@ -792,16 +793,16 @@ } break; case 4: - if(voice->stream->nstereo == 1) { + if (voice->stream->nstereo == 1) { fxsend.a.dest = voice->voicenum * 2; fxsend.a.level = maxlevel; fxsend.b.dest = voice->voicenum * 2 + 2; fxsend.b.level = maxlevel; - } else if((voice->stream->nstereo == 2) || + } else if ((voice->stream->nstereo == 2) || ((voice->stream->nstereo == 3)&&(voice->voicenum < 2))) { fxsend.a.dest = voice->voicenum * 2; fxsend.a.level = maxlevel; - } else if(voice->stream->nstereo == 3 && voice->voicenum > 1) { + } else if (voice->stream->nstereo == 3 && voice->voicenum > 1) { fxsend.a.dest = 0x0; fxsend.a.level = maxlevel / 2; fxsend.b.dest = 0x1; @@ -811,7 +812,7 @@ } break; case 6: // only on audigy - if(voice->stream->nstereo == 1) { + if (voice->stream->nstereo == 1) { fxsend.a.dest = voice->voicenum * 2; fxsend.a.level = maxlevel; fxsend.b.dest = voice->voicenum * 2 + 2; @@ -820,16 +821,16 @@ fxsend.c.level = maxlevel / 2; fxsend.d.dest = 0x5; fxsend.d.level = maxlevel / 2; - } else if(voice->stream->nstereo == 2) { + } else if (voice->stream->nstereo == 2) { fxsend.a.dest = voice->voicenum * 2; fxsend.a.level = maxlevel; - if(voice->voicenum < 1) { + if (voice->voicenum < 1) { fxsend.b.dest = 0x4; fxsend.b.level = maxlevel / 2; fxsend.c.dest = 0x5; fxsend.c.level = maxlevel / 2; } - } else if(voice->stream->nstereo == 3) { + } else if (voice->stream->nstereo == 3) { fxsend.a.dest = voice->voicenum * 2; fxsend.a.level = maxlevel; } else { @@ -843,16 +844,16 @@ switch(voice->stream->card->play_mode) { case 2: - if(voice->stream->nstereo == 1) { + if (voice->stream->nstereo == 1) { fxsend.a.dest = voice->voicenum * 2 + 1; fxsend.a.level = maxlevel; - } else if((voice->stream->nstereo == 2) || + } else if ((voice->stream->nstereo == 2) || ((voice->stream->nstereo == 3)&&(voice->voicenum < 2))) { fxsend.a.dest = voice->voicenum * 2 + 1; fxsend.a.level = maxlevel; - if(voice->voicenum > 1 - 1) + if (voice->voicenum > 1 - 1) fxsend.a.dest-=2; - } else if(voice->stream->nstereo == 3 && voice->voicenum > 1) { + } else if (voice->stream->nstereo == 3 && voice->voicenum > 1) { fxsend.a.dest = 0x0; fxsend.a.level = maxlevel / 2; fxsend.b.dest = 0x1; @@ -862,16 +863,16 @@ } break; case 4: - if(voice->stream->nstereo == 1) { + if (voice->stream->nstereo == 1) { fxsend.a.dest = voice->voicenum * 2 + 1; fxsend.a.level = maxlevel; fxsend.b.dest = voice->voicenum * 2 + 3; fxsend.b.level = maxlevel; - } else if((voice->stream->nstereo == 2) || + } else if ((voice->stream->nstereo == 2) || ((voice->stream->nstereo == 3)&&(voice->voicenum < 2))) { fxsend.a.dest = voice->voicenum * 2 + 1; fxsend.a.level = maxlevel; - } else if(voice->stream->nstereo == 3 && voice->voicenum > 1) { + } else if (voice->stream->nstereo == 3 && voice->voicenum > 1) { fxsend.a.dest = 0x0; fxsend.a.level = maxlevel / 2; fxsend.b.dest = 0x1; @@ -881,7 +882,7 @@ } break; case 6: // only on audigy - if(voice->stream->nstereo == 1) { + if (voice->stream->nstereo == 1) { fxsend.a.dest = voice->voicenum * 2 + 1; fxsend.a.level = maxlevel; fxsend.b.dest = voice->voicenum * 2 + 3; @@ -890,16 +891,16 @@ fxsend.c.level = maxlevel / 2; fxsend.d.dest = 0x5; fxsend.d.level = maxlevel / 2; - } else if(voice->stream->nstereo == 2) { + } else if (voice->stream->nstereo == 2) { fxsend.a.dest = voice->voicenum * 2 + 1; fxsend.a.level = maxlevel; - if(voice->voicenum < 1) { + if (voice->voicenum < 1) { fxsend.b.dest = 0x4; fxsend.b.level = maxlevel / 2; fxsend.c.dest = 0x5; fxsend.c.level = maxlevel / 2; } - } else if(voice->stream->nstereo == 3) { + } else if (voice->stream->nstereo == 3) { fxsend.a.dest = voice->voicenum * 2 + 1; fxsend.a.level = maxlevel; } else { @@ -913,21 +914,21 @@ } else { switch(voice->stream->card->play_mode) { case 2: - if(voice->stream->nmono == 1) { + if (voice->stream->nmono == 1) { fxsend.a.dest = voice->voicenum; fxsend.a.level = maxlevel; fxsend.b.dest = voice->voicenum + 1; fxsend.b.level = maxlevel; - } else if(voice->stream->nmono == 2) { + } else if (voice->stream->nmono == 2) { fxsend.a.dest = voice->voicenum; fxsend.a.level = maxlevel; - } else if((voice->stream->nmono == 4) || + } else if ((voice->stream->nmono == 4) || ((voice->stream->nmono == 6)&&(voice->voicenum < 4))) { fxsend.a.dest = voice->voicenum; fxsend.a.level = maxlevel; - if(voice->voicenum > 2 - 1) + if (voice->voicenum > 2 - 1) fxsend.a.dest-=2; - } else if(voice->stream->nmono == 6 && voice->voicenum > 3) { + } else if (voice->stream->nmono == 6 && voice->voicenum > 3) { fxsend.a.dest = 0x0; fxsend.a.level = maxlevel / 2; fxsend.b.dest = 0x1; @@ -937,7 +938,7 @@ } break; case 4: - if(voice->stream->nmono == 1) { + if (voice->stream->nmono == 1) { fxsend.a.dest = voice->voicenum; fxsend.a.level = maxlevel; fxsend.b.dest = voice->voicenum + 1; @@ -946,16 +947,16 @@ fxsend.c.level = maxlevel; fxsend.d.dest = voice->voicenum + 3; fxsend.d.level = maxlevel; - } else if(voice->stream->nmono == 2) { + } else if (voice->stream->nmono == 2) { fxsend.a.dest = voice->voicenum; fxsend.a.level = maxlevel; fxsend.b.dest = voice->voicenum + 2; fxsend.b.level = maxlevel; - } else if((voice->stream->nmono == 4) || + } else if ((voice->stream->nmono == 4) || ((voice->stream->nmono == 6)&&(voice->voicenum < 4))) { fxsend.a.dest = voice->voicenum; fxsend.a.level = maxlevel; - } else if(voice->stream->nmono == 6 && voice->voicenum > 3) { + } else if (voice->stream->nmono == 6 && voice->voicenum > 3) { fxsend.a.dest = 0x0; fxsend.a.level = maxlevel / 2; fxsend.b.dest = 0x1; @@ -965,7 +966,7 @@ } break; case 6: // only on audigy - if(voice->stream->nmono == 1) { + if (voice->stream->nmono == 1) { fxsend.a.dest = voice->voicenum; fxsend.a.level = maxlevel; fxsend.b.dest = voice->voicenum + 1; @@ -978,7 +979,7 @@ fxsend.e.level = maxlevel; fxsend.f.dest = voice->voicenum + 5; fxsend.f.level = maxlevel; - } else if(voice->stream->nmono == 2) { + } else if (voice->stream->nmono == 2) { fxsend.a.dest = voice->voicenum; fxsend.a.level = maxlevel; fxsend.b.dest = voice->voicenum + 2; @@ -987,16 +988,16 @@ fxsend.c.level = maxlevel / 2; fxsend.d.dest = 0x5; fxsend.d.level = maxlevel / 2; - } else if(voice->stream->nmono == 4) { + } else if (voice->stream->nmono == 4) { fxsend.a.dest = voice->voicenum; fxsend.a.level = maxlevel; - if(voice->voicenum < 2) { + if (voice->voicenum < 2) { fxsend.b.dest = 0x4; fxsend.b.level = maxlevel / 2; fxsend.c.dest = 0x5; fxsend.c.level = maxlevel / 2; } - } else if(voice->stream->nmono == 6) { + } else if (voice->stream->nmono == 6) { fxsend.a.dest = voice->voicenum; fxsend.a.level = maxlevel; } else { @@ -1063,14 +1064,14 @@ emuxki_voice_set_recparms(emuxki_voice *voice, emuxki_recsrc_t recsrc, emuxki_recparams *recparams) { - if(voice->use & EMU_USE_RECORD) { + if (voice->use & EMU_USE_RECORD) { switch(recsrc) { case EMU_RECSRC_MIC: break; case EMU_RECSRC_ADC: break; case EMU_RECSRC_FX: - if(!recparams) + if (!recparams) return B_ERROR; voice->recparams.efx_voices[0] = recparams->efx_voices[0]; voice->recparams.efx_voices[1] = recparams->efx_voices[1]; @@ -1166,7 +1167,7 @@ LOG(("emuxki_voice_commit_parms idx_reg : %u\n", idx_reg)); idx_reg = EMU_RECIDX(idx_reg); - while(emuxki_chan_read(&voice->stream->card->config, 0, idx_reg)) + while (emuxki_chan_read(&voice->stream->card->config, 0, idx_reg)) snooze(5); } return B_OK; @@ -1227,7 +1228,7 @@ if (timerate & ~EMU_TIMER_RATE_MASK) timerate = 0; - if(card->timerate > timerate) { + if (card->timerate > timerate) { LOG(("emuxki_resched_timer written (old %u, new %u)\n", card->timerate, timerate)); card->timerate = timerate; emuxki_reg_write_16(&card->config, EMU_TIMER, timerate); @@ -1269,19 +1270,19 @@ return EMU_ADCCR_SAMPLERATE_16; break; case 12000: - if(IS_AUDIGY(&voice->stream->card->config)) + if (IS_AUDIGY(&voice->stream->card->config)) return EMU_A_ADCCR_SAMPLERATE_12; else PRINT(("recording sample_rate not supported : %lu\n", voice->sample_rate)); break; case 11000: - if(IS_AUDIGY(&voice->stream->card->config)) + if (IS_AUDIGY(&voice->stream->card->config)) return EMU_A_ADCCR_SAMPLERATE_11; else return EMU_ADCCR_SAMPLERATE_11; break; case 8000: - if(IS_AUDIGY(&voice->stream->card->config)) + if (IS_AUDIGY(&voice->stream->card->config)) return EMU_A_ADCCR_SAMPLERATE_8; else return EMU_ADCCR_SAMPLERATE_8; @@ -1312,7 +1313,7 @@ uint32 adccr_value = 0; adccr_value = emuxki_voice_adc_rate(voice); LOG(("emuxki_voice_start adccr_value : %u\n", adccr_value)); - if(voice->stereo) + if (voice->stereo) adccr_value |= ( (IS_AUDIGY(&voice->stream->card->config) ? EMU_A_ADCCR_LCHANENABLE : EMU_ADCCR_LCHANENABLE ) | ( IS_AUDIGY(&voice->stream->card->config) ? EMU_A_ADCCR_RCHANENABLE : EMU_ADCCR_RCHANENABLE )); else @@ -1325,7 +1326,7 @@ } break; case EMU_RECSRC_FX: - if(IS_AUDIGY(&voice->stream->card->config)) { + if (IS_AUDIGY(&voice->stream->card->config)) { emuxki_chan_write(&voice->stream->card->config, 0, EMU_A_FXWC1, voice->recparams.efx_voices[0]); emuxki_chan_write(&voice->stream->card->config, 0, EMU_A_FXWC2, @@ -1366,7 +1367,7 @@ emuxki_inte_disable(&voice->stream->card->config, EMU_INTE_ADCBUFENABLE); break; case EMU_RECSRC_FX: - if(IS_AUDIGY(&voice->stream->card->config)) { + if (IS_AUDIGY(&voice->stream->card->config)) { emuxki_chan_write(&voice->stream->card->config, 0, EMU_A_FXWC1, 0); emuxki_chan_write(&voice->stream->card->config, 0, EMU_A_FXWC2, 0); } else @@ -1442,7 +1443,7 @@ return B_OK; LIST_FOREACH(voice, &stream->voices, next) { - if(voice->buffer) + if (voice->buffer) emuxki_mem_free(stream->card, voice->buffer->log_base); emuxki_voice_delete(voice); } @@ -1452,7 +1453,7 @@ stream->b16 = b16; stream->sample_rate = sample_rate; - if(stereo && (channels % 2 == 0)) { + if (stereo && (channels % 2 == 0)) { stream->stereo = true; stream->nstereo = channels / 2; stream->nmono = 0; @@ -1467,10 +1468,10 @@ sample_size = stream->b16 + 1; frame_size = sample_size * (stream->stereo ? 2 : 1); - for(i=0; iuse, i); - if(voice) { - if(!stream->first_voice) + if (voice) { + if (!stream->first_voice) stream->first_voice = voice; LIST_INSERT_HEAD((&stream->voices), voice, next); if ((error = emuxki_voice_set_audioparms(voice, stream->stereo, stream->b16, stream->sample_rate))) @@ -1497,14 +1498,14 @@ emuxki_voice *voice; LOG(("emuxki_stream_set_recparms\n")); - if(stream->use & EMU_USE_RECORD) { + if (stream->use & EMU_USE_RECORD) { switch(recsrc) { case EMU_RECSRC_MIC: break; case EMU_RECSRC_ADC: break; case EMU_RECSRC_FX: - if(!recparams) + if (!recparams) return B_ERROR; LIST_FOREACH(voice, &stream->voices, next) { voice->recparams.efx_voices[0] = recparams->efx_voices[0]; @@ -1544,35 +1545,35 @@ LOG(("emuxki_stream_get_nth_buffer\n")); sample_size = stream->b16 + 1; - if(buf >= stream->bufcount) + if (buf >= stream->bufcount) return B_BAD_INDEX; - if(stream->stereo) { + if (stream->stereo) { i = stream->nstereo - 1; - if(chan/2 > i) + if (chan/2 > i) return B_BAD_INDEX; LIST_FOREACH(voice, &stream->voices, next) - if(i != chan/2) + if (i != chan/2) i--; else break; - if(voice) { + if (voice) { *buffer = (char*)voice->buffer->log_base + (buf * stream->bufframes * sample_size * 2); - if(chan % 2 == 1) + if (chan % 2 == 1) *buffer += sample_size; *stride = sample_size * 2; } else return B_ERROR; } else { i = stream->nmono - 1; - if(chan > i) + if (chan > i) return B_BAD_INDEX; LIST_FOREACH(voice, &stream->voices, next) - if(i != chan) + if (i != chan) i--; else break; - if(voice) { + if (voice) { *buffer = (char*)voice->buffer->log_base + (buf * stream->bufframes * sample_size); *stride = sample_size; } else @@ -1660,10 +1661,10 @@ LIST_REMOVE(stream, next); unlock(status); - while(!LIST_EMPTY(&stream->voices)) { + while (!LIST_EMPTY(&stream->voices)) { voice = LIST_FIRST(&stream->voices); LIST_REMOVE(voice, next); - if(voice->buffer) + if (voice->buffer) emuxki_mem_free(stream->card, voice->buffer->log_base); emuxki_voice_delete(voice); } @@ -1701,27 +1702,27 @@ switch(type) { case EMU_MIX_MUTE: gpr->mute = (values[0] == 1.0); - if(gpr->mute) { - for(i=0; imute) { + for (i=0; iconfig, gpr->gpr + i, 0); break; } - for(i=0; icurrent[i]; } case EMU_MIX_GAIN: - for(i=0; igpr->max_gain || values[i]min_gain) + for (i=0; igpr->max_gain || values[i]min_gain) return; index = (int32)(values[i] / gpr->granularity); - if(index > sizeof(db_table)/sizeof(db_table[0])) + if (index > sizeof(db_table)/sizeof(db_table[0])) index = sizeof(db_table)/sizeof(db_table[0]); - else if(index < 0) + else if (index < 0) index = 0; LOG(("emuxki_set_gpr gpr: %d \n", gpr->gpr + i)); LOG(("emuxki_set_gpr values[i]: %g \n", values[i])); LOG(("emuxki_set_gpr index: %u \n", index)); - if(!gpr->mute) + if (!gpr->mute) emuxki_write_gpr(&card->config, gpr->gpr + i, db_table[index]); gpr->current[i] = index * gpr->granularity; } @@ -1739,7 +1740,7 @@ switch(type) { case EMU_MIX_GAIN: - for(i=0; icurrent[i]; } break; @@ -1757,7 +1758,7 @@ LOG(("emuxki_dump_gprs\n")); - for(pc = 0; pc < count; pc++) { + for (pc = 0; pc < count; pc++) { value = emuxki_read_gpr(&card->config, pc); LOG(("dsp_gpr pc=%x, value=%x\n", pc, value)); } @@ -1782,16 +1783,16 @@ gpr->granularity = granularity; gpr->mute = false; (*gpr_num)++; - if(gpr->type & EMU_MIX_STEREO) + if (gpr->type & EMU_MIX_STEREO) (*gpr_num)++; - if(default_mute == 1.0) { + if (default_mute == 1.0) { values[0] = default_mute; emuxki_gpr_set(card, gpr, EMU_MIX_MUTE, values); } values[0] = gpr->default_value; - if(gpr->type & EMU_MIX_STEREO) + if (gpr->type & EMU_MIX_STEREO) values[1] = gpr->default_value; emuxki_gpr_set(card, gpr, EMU_MIX_GAIN, values); @@ -1811,8 +1812,8 @@ switch(type) { case EMU_DIGITAL_MODE: card->digital_enabled = *value == 1; - if(IS_AUDIGY(&card->config)) - if(IS_AUDIGY2(&card->config)) { + if (IS_AUDIGY(&card->config)) + if (IS_AUDIGY2(&card->config)) { // this disables analog, not enough emuxki_reg_write_32(&card->config, EMU_A_IOCFG, (card->digital_enabled ? 0 : EMU_A_IOCFG_GPOUT0) | @@ -1834,7 +1835,7 @@ break; case EMU_AUDIO_MODE: - if(*value!=0 && *value!=1 && *value!=2) { + if (*value!=0 && *value!=1 && *value!=2) { PRINT(("emuxki_parameter_set error value unexpected\n")); return; } @@ -1901,7 +1902,7 @@ //trace_hardware_regs(&card->config); //TRACE(("voice pointer %p\n", voice)); - if(stream->inth) + if (stream->inth) stream->inth(stream->inthparam); voice->trigblk++; @@ -1915,7 +1916,7 @@ } if (ipr & (EMU_IPR_MIDITRANSBUFE)) { - if(!midi_interrupt(card)) { + if (!midi_interrupt(card)) { emuxki_inte_disable(&card->config, EMU_INTE_MIDITXENABLE); TRACE(("EMU_INTE_MIDITXENABLE disabled\n")); } @@ -1941,7 +1942,7 @@ //dump_voice(voice); //trace_hardware_regs(&card->config); - if(stream->inth) + if (stream->inth) stream->inth(stream->inthparam); voice->trigblk++; @@ -1975,13 +1976,13 @@ emuxki_reg_write_32(&card->config, EMU_IPR, ipr); } - if(IS_AUDIGY2(&card->config)) { + if (IS_AUDIGY2(&card->config)) { while ((ipr = emuxki_reg_read_32(&card->config, EMU_A2_IPR2))) { emuxki_reg_write_32(&card->config, EMU_A2_IPR2, ipr); break; // avoid loop } - if (card->info.revision == 4) { + if (!IS_AUDIGY2_VALUE(&card->config)) { while ((ipr = emuxki_reg_read_32(&card->config, EMU_A2_IPR3))) { emuxki_reg_write_32(&card->config, EMU_A2_IPR3, ipr); break; // avoid loop @@ -1989,7 +1990,7 @@ } } - if(gotone) + if (gotone) return B_INVOKE_SCHEDULER; TRACE(("Got unhandled interrupt\n")); @@ -2021,6 +2022,7 @@ (info.device_id == CREATIVELABS_SBLIVE_DEVICE_ID #if AUDIGY || info.device_id == CREATIVELABS_AUDIGY_DEVICE_ID + || info.device_id == CREATIVELABS_AUDIGY2_VALUE_DEVICE_ID #endif )) { err = B_OK; @@ -2062,10 +2064,12 @@ card->config.nabmbar = card->info.u.h0.base_registers[0]; card->config.irq = card->info.u.h0.interrupt_line; card->config.type = 0; - if(card->info.device_id == CREATIVELABS_AUDIGY_DEVICE_ID) + if (card->info.device_id == CREATIVELABS_AUDIGY_DEVICE_ID) { card->config.type |= TYPE_AUDIGY; - if(IS_AUDIGY(&card->config) && (card->info.revision == 4 || card->info.revision == 8)) - card->config.type |= TYPE_AUDIGY2; + if (card->info.revision == 4) + card->config.type |= TYPE_AUDIGY2; + } else if (card->info.device_id == CREATIVELABS_AUDIGY2_VALUE_DEVICE_ID) + card->config.type |= TYPE_AUDIGY | TYPE_AUDIGY2 | TYPE_AUDIGY2_VALUE; PRINT(("%s deviceid = %#04x chiprev = %x model = %x enhanced at %lx\n", card->name, card->info.device_id, card->info.revision, card->info.u.h0.subsystem_id, card->config.nabmbar)); @@ -2104,7 +2108,7 @@ PRINT(("codec description = %s\n",ac97_get_vendor_id_description(&card->config))); PRINT(("codec 3d enhancement = %s\n",ac97_get_3d_stereo_enhancement(&card->config))); - if(IS_AUDIGY2(&card->config)) { + if (IS_AUDIGY2(&card->config)) { emuxki_reg_write_32(&card->config, EMU_A_IOCFG, EMU_A_IOCFG_GPOUT0 | emuxki_reg_read_32(&card->config, EMU_A_IOCFG)); } @@ -2167,16 +2171,16 @@ if ((err = emuxki_init(card))) return (err); - if(IS_AUDIGY(&card->config) || IS_LIVE_5_1(&card->config)) { + if (IS_AUDIGY(&card->config) || IS_LIVE_5_1(&card->config)) { card->play_mode = 6; // mode 5.1 } else { card->play_mode = 4; // mode 4.0 } emuxki_reg_write_32(&card->config, EMU_INTE, EMU_INTE_SAMPLERATER | EMU_INTE_PCIERRENABLE); - if(IS_AUDIGY2(&card->config)) { + if (IS_AUDIGY2(&card->config)) { emuxki_reg_write_32(&card->config, EMU_A2_INTE2, 0); - if (card->info.revision == 4) { + if (!IS_AUDIGY2_VALUE(&card->config)) { emuxki_reg_write_32(&card->config, EMU_A2_INTE3, 0); } } @@ -2186,11 +2190,11 @@ emuxki_inte_enable(&card->config, EMU_INTE_VOLINCRENABLE | EMU_INTE_VOLDECRENABLE | EMU_INTE_MUTEENABLE | EMU_INTE_FXDSPENABLE); - if(IS_AUDIGY2(&card->config)) { + if (IS_AUDIGY2(&card->config)) { emuxki_reg_write_32(&card->config, EMU_HCFG, EMU_HCFG_AUDIOENABLE | EMU_HCFG_AC3ENABLE_CDSPDIF | EMU_HCFG_AC3ENABLE_GPSPDIF| EMU_HCFG_JOYENABLE | EMU_HCFG_AUTOMUTE); - } else if(IS_AUDIGY(&card->config)) { + } else if (IS_AUDIGY(&card->config)) { emuxki_reg_write_32(&card->config, EMU_HCFG, EMU_HCFG_AUDIOENABLE | EMU_HCFG_JOYENABLE | EMU_HCFG_AUTOMUTE); } else { @@ -2216,7 +2220,7 @@ while (pc < 512) { emuxki_dsp_getop(&card->config, &pc, &op, &r, &a, &x, &y); - if(op!=EMU_DSP_OP_ACC3 || r!=zero || a!=zero || x!=zero || y!=zero) { + if (op!=EMU_DSP_OP_ACC3 || r!=zero || a!=zero || x!=zero || y!=zero) { LOG(("dsp_op pc=%u, op=%x, r=%x, a=%x, x=%x, y=%x\n", pc, op, r, a, x, y)); } @@ -2256,7 +2260,7 @@ EMU_MIX_GAIN|EMU_MIX_STEREO|EMU_MIX_MUTE|EMU_MIX_PLAYBACK, &gpr, 0.0, 0.0, -46.5, 0.0, -0.75); a_rear_gpr = emuxki_gpr_new(card, "Analog Rear", EMU_MIX_GAIN|EMU_MIX_STEREO|EMU_MIX_MUTE|EMU_MIX_PLAYBACK, &gpr, 0.0, 0.0, -46.5, 0.0, -0.75); - if(IS_AUDIGY(&card->config) || IS_LIVE_5_1(&card->config)) + if (IS_AUDIGY(&card->config) || IS_LIVE_5_1(&card->config)) a_center_sub_gpr = emuxki_gpr_new(card, "Analog Center/Sub", EMU_MIX_GAIN|EMU_MIX_STEREO|EMU_MIX_MUTE|EMU_MIX_PLAYBACK, &gpr, 0.0, 0.0, -46.5, 0.0, -0.75); @@ -2283,7 +2287,7 @@ card->gpr_count = gpr; - if(IS_AUDIGY(&card->config)) { + if (IS_AUDIGY(&card->config)) { /* DSP_IN_GPR(l/r) = 0 + AC97In(l/r) * P_AC97_IN_GPR(l/r) */ emuxki_dsp_addop(&card->config, &pc, EMU_DSP_OP_MACS, EMU_A_DSP_GPR(EMU_DSP_TMPGPR_DSP_IN_L), @@ -2516,7 +2520,7 @@ EMU_DSP_GPR(EMU_DSP_TMPGPR_REAR_RIGHT), EMU_DSP_GPR(a_rear_gpr->gpr+1)); /* Analog Center/Sub = 0 + Center/Sub GPR(l/r) * A_CENTER_GPR(l/r) */ - if(IS_LIVE_5_1(&card->config)) { + if (IS_LIVE_5_1(&card->config)) { emuxki_dsp_addop(&card->config, &pc, EMU_DSP_OP_MACS, EMU_DSP_OUT_A_CENTER, EMU_DSP_CST(0), @@ -2630,7 +2634,7 @@ emuxki_chan_write(&card->config, 0, EMU_ADCBS, EMU_RECBS_BUFSIZE_NONE); emuxki_chan_write(&card->config, 0, EMU_ADCBA, 0); - if(IS_AUDIGY(&card->config)) { + if (IS_AUDIGY(&card->config)) { emuxki_chan_write(&card->config, 0, EMU_SPBYPASS, EMU_SPBYPASS_24_BITS); emuxki_chan_write(&card->config, 0, EMU_AC97SLOT, EMU_AC97SLOT_CENTER | EMU_AC97SLOT_LFE); } @@ -2676,21 +2680,21 @@ emuxki_chan_write(&card->config, 0, EMU_SPCS1, spcs); emuxki_chan_write(&card->config, 0, EMU_SPCS2, spcs); - if(IS_AUDIGY2(&card->config)) { + if (IS_AUDIGY2(&card->config)) { emuxki_chan_write(&card->config, 0, EMU_A2_SPDIF_SAMPLERATE, EMU_A2_SPDIF_UNKNOWN); emuxki_p16v_write(&card->config, 0, EMU_A2_SRCSEL, EMU_A2_SRCSEL_ENABLE_SPDIF | EMU_A2_SRCSEL_ENABLE_SRCMULTI); - if (card->info.revision == 4) { - emuxki_p16v_write(&card->config, 0, EMU_A2_SRCMULTI, EMU_A2_SRCMULTI_ENABLE_INPUT); - } else { + if (IS_AUDIGY2_VALUE(&card->config)) { emuxki_p16v_write(&card->config, 0, EMU_A2_P17V_I2S, EMU_A2_P17V_I2S_ENABLE); emuxki_p16v_write(&card->config, 0, EMU_A2_P17V_SPDIF, EMU_A2_P17V_SPDIF_ENABLE); emuxki_reg_write_32(&card->config, EMU_A_IOCFG, emuxki_reg_read_32(&card->config, EMU_A_IOCFG) & ~0x8); - } + } else { + emuxki_p16v_write(&card->config, 0, EMU_A2_SRCMULTI, EMU_A2_SRCMULTI_ENABLE_INPUT); + } } /* Let's play with sound processor */ @@ -2823,6 +2827,7 @@ (info.device_id == CREATIVELABS_SBLIVE_DEVICE_ID #if AUDIGY || info.device_id == CREATIVELABS_AUDIGY_DEVICE_ID + || info.device_id == CREATIVELABS_AUDIGY2_VALUE_DEVICE_ID #endif )) { if (num_cards == NUM_CARDS) { @@ -2891,7 +2896,7 @@ emuxki_chan_write(&card->config, 0, EMU_MICBA, 0); emuxki_chan_write(&card->config, 0, EMU_FXBS, EMU_RECBS_BUFSIZE_NONE); emuxki_chan_write(&card->config, 0, EMU_FXBA, 0); - if(IS_AUDIGY(&card->config)) { + if (IS_AUDIGY(&card->config)) { emuxki_chan_write(&card->config, 0, EMU_A_FXWC1, 0); emuxki_chan_write(&card->config, 0, EMU_A_FXWC2, 0); } else { Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.h 2008-01-11 14:04:53 UTC (rev 23398) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.h 2008-01-11 14:17:17 UTC (rev 23399) @@ -53,6 +53,7 @@ #define CREATIVELABS_VENDOR_ID 0x1102 /* Creative Labs */ #define CREATIVELABS_SBLIVE_DEVICE_ID 0x0002 /* Creative Labs SoundBlaster Live */ #define CREATIVELABS_AUDIGY_DEVICE_ID 0x0004 /* Creative Labs Audigy and Audigy 2 */ +#define CREATIVELABS_AUDIGY2_VALUE_DEVICE_ID 0x0008 /* Creative Labs Audigy 2 Value */ #define AUDIGY 1 // Audigy seems to work #ifdef __HAIKU__ @@ -68,6 +69,7 @@ #define FRIENDLY_NAME_LIVE_5_1 FRIENDLY_NAME_LIVE" 5.1" #define FRIENDLY_NAME_AUDIGY FRIENDLY_NAME" Audigy" #define FRIENDLY_NAME_AUDIGY2 FRIENDLY_NAME_AUDIGY" 2" +#define FRIENDLY_NAME_AUDIGY2_VALUE FRIENDLY_NAME_AUDIGY2" Value" #define AUTHOR "J?r?me Duval" /* Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/multi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/multi.c 2008-01-11 14:04:53 UTC (rev 23398) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/multi.c 2008-01-11 14:17:17 UTC (rev 23399) @@ -51,24 +51,24 @@ case B_MIX_GAIN: value = emuxki_codec_read(&dev->config, info->reg); //PRINT(("B_MIX_GAIN value : %u\n", value)); - if(info->type & B_MIX_STEREO) { + if (info->type & B_MIX_STEREO) { mask = ((1 << (info->bits + 1)) - 1) << 8; gain = ((value & mask) >> 8) * info->granularity; - if(info->polarity == 1) + if (info->polarity == 1) values[0] = info->max_gain - gain; else values[0] = gain - info->min_gain; mask = ((1 << (info->bits + 1)) - 1); gain = (value & mask) * info->granularity; - if(info->polarity == 1) + if (info->polarity == 1) values[1] = info->max_gain - gain; else values[1] = gain - info->min_gain; } else { mask = ((1 << (info->bits + 1)) - 1); gain = (value & mask) * info->granularity; - if(info->polarity == 1) + if (info->polarity == 1) values[0] = info->max_gain - gain; else values[0] = gain - info->min_gain; @@ -108,11 +108,11 @@ switch(type) { case B_MIX_GAIN: value = emuxki_codec_read(&dev->config, info->reg); - if(info->type & B_MIX_STEREO) { + if (info->type & B_MIX_STEREO) { mask = ((1 << (info->bits + 1)) - 1) << 8; value &= ~mask; - if(info->polarity == 1) + if (info->polarity == 1) gain = info->max_gain - values[0]; else gain = values[0] - info->min_gain; @@ -120,7 +120,7 @@ mask = ((1 << (info->bits + 1)) - 1); value &= ~mask; - if(info->polarity == 1) + if (info->polarity == 1) gain = info->max_gain - values[1]; else gain = values[1] - info->min_gain; @@ -128,7 +128,7 @@ } else { mask = ((1 << (info->bits + 1)) - 1); value &= ~mask; - if(info->polarity == 1) + if (info->polarity == 1) gain = info->max_gain - values[0]; else gain = values[0] - info->min_gain; @@ -142,7 +142,7 @@ value = emuxki_codec_read(&dev->config, info->reg); value &= ~mask; value |= ((values[0] == 1.0 ? 1 : 0 ) << 15 & mask); - if(info->reg == AC97_SURROUND_VOLUME) { + if (info->reg == AC97_SURROUND_VOLUME) { // there is a independent mute for each channel mask = ((1 << 1) - 1) << 7; value &= ~mask; @@ -204,7 +204,7 @@ multi->controls[i].mix_control.flags = B_MULTI_MIX_GROUP; multi->controls[i].mix_control.master = EMU_MULTI_CONTROL_MASTERID; multi->controls[i].mix_control.string = string; - if(name) + if (name) strcpy(multi->controls[i].mix_control.name, name); return multi->controls[i].mix_control.id; @@ -225,8 +225,8 @@ control.mix_control.u.gain.max_gain = gpr->max_gain; control.mix_control.u.gain.granularity = gpr->granularity; - if(gpr->type & EMU_MIX_GAIN) { - if(gpr->type & EMU_MIX_MUTE) { + if (gpr->type & EMU_MIX_GAIN) { + if (gpr->type & EMU_MIX_MUTE) { control.mix_control.id = EMU_MULTI_CONTROL_FIRSTID + i; control.mix_control.flags = B_MULTI_MIX_ENABLE; control.mix_control.string = S_MUTE; @@ -243,7 +243,7 @@ id = control.mix_control.id; i++; - if(gpr->type & EMU_MIX_STEREO) { + if (gpr->type & EMU_MIX_STEREO) { control.mix_control.id = EMU_MULTI_CONTROL_FIRSTID + i; control.mix_control.master = id; multi->controls[i] = control; @@ -262,28 +262,28 @@ parent = emuxki_create_group_control(multi, &index, 0, 0, "Playback"); - for(i=EMU_GPR_FIRST_MIX; igpr_count; i++) { + for (i=EMU_GPR_FIRST_MIX; igpr_count; i++) { const emuxki_gpr *gpr = &card->gpr[i]; - if((gpr->type & EMU_MIX_PLAYBACK) == 0) + if ((gpr->type & EMU_MIX_PLAYBACK) == 0) continue; parent2 = emuxki_create_group_control(multi, &index, parent, 0, gpr->name); emuxki_create_gpr_control(multi, &index, parent2, 0, gpr); - if(gpr->type & EMU_MIX_GAIN && gpr->type & EMU_MIX_STEREO) + if (gpr->type & EMU_MIX_GAIN && gpr->type & EMU_MIX_STEREO) i++; } parent = emuxki_create_group_control(multi, &index, 0, 0, "Record"); - for(i=EMU_GPR_FIRST_MIX; igpr_count; i++) { + for (i=EMU_GPR_FIRST_MIX; igpr_count; i++) { const emuxki_gpr *gpr = &card->gpr[i]; - if((gpr->type & EMU_MIX_RECORD) == 0) + if ((gpr->type & EMU_MIX_RECORD) == 0) continue; parent2 = emuxki_create_group_control(multi, &index, parent, 0, gpr->name); emuxki_create_gpr_control(multi, &index, parent2, 0, gpr); - if(gpr->type & EMU_MIX_GAIN && gpr->type & EMU_MIX_STEREO) + if (gpr->type & EMU_MIX_GAIN && gpr->type & EMU_MIX_STEREO) i++; } @@ -293,8 +293,8 @@ parent2 = emuxki_create_group_control(multi, &index, parent, 0, info->name); - if(info->type & B_MIX_GAIN) { - if(info->type & B_MIX_MUTE) { + if (info->type & B_MIX_GAIN) { + if (info->type & B_MIX_MUTE) { multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_ENABLE; multi->controls[index].mix_control.master = EMU_MULTI_CONTROL_MASTERID; @@ -322,7 +322,7 @@ id = multi->controls[index].mix_control.id; index++; - if(info->type & B_MIX_STEREO) { + if (info->type & B_MIX_STEREO) { multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_GAIN; multi->controls[index].mix_control.master = id; @@ -338,7 +338,7 @@ index++; } - if(info->type & B_MIX_RECORDMUX) { + if (info->type & B_MIX_RECORDMUX) { multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_MUX; multi->controls[index].mix_control.parent = parent2; @@ -396,19 +396,19 @@ parent = emuxki_create_group_control(multi, &index, 0, 0, "AC97 Mixer"); count = source_info_size; - if(IS_AUDIGY2(&card->config)) + if (IS_AUDIGY2(&card->config)) count = 1; - if(!IS_LIVE_5_1(&card->config) && !IS_AUDIGY(&card->config)) + if (!IS_LIVE_5_1(&card->config) && !IS_AUDIGY(&card->config)) count--; - for(i=1; i < count ; i++) { + for (i=1; i < count ; i++) { info = &source_info[i]; PRINT(("name : %s\n", info->name)); parent2 = emuxki_create_group_control(multi, &index, parent, 0, info->name); - if(info->type & B_MIX_GAIN) { - if(info->type & B_MIX_MUTE) { + if (info->type & B_MIX_GAIN) { + if (info->type & B_MIX_MUTE) { multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_ENABLE; multi->controls[index].mix_control.master = EMU_MULTI_CONTROL_MASTERID; @@ -436,7 +436,7 @@ [... truncated: 318 lines follow ...] From mmu_man at mail.berlios.de Fri Jan 11 14:52:48 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 14:52:48 +0100 Subject: [Haiku-commits] r23396 - haiku/trunk/src/system/libroot/posix/unistd Message-ID: <200801111352.m0BDqmAX032544@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 14:52:48 +0100 (Fri, 11 Jan 2008) New Revision: 23396 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23396&view=rev Modified: haiku/trunk/src/system/libroot/posix/unistd/getlogin.c haiku/trunk/src/system/libroot/posix/unistd/usergroup.c Log: cuserid also goes there... Modified: haiku/trunk/src/system/libroot/posix/unistd/getlogin.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/getlogin.c 2008-01-11 13:47:45 UTC (rev 23395) +++ haiku/trunk/src/system/libroot/posix/unistd/getlogin.c 2008-01-11 13:52:48 UTC (rev 23396) @@ -36,3 +36,13 @@ return ENOMEM; } + +char * +cuserid(char *s) +{ + if (s != NULL && getlogin_r(s, L_cuserid)) + return s; + + return getlogin(); +} + Modified: haiku/trunk/src/system/libroot/posix/unistd/usergroup.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/usergroup.c 2008-01-11 13:47:45 UTC (rev 23395) +++ haiku/trunk/src/system/libroot/posix/unistd/usergroup.c 2008-01-11 13:52:48 UTC (rev 23396) @@ -51,16 +51,6 @@ } -char * -cuserid(char *s) -{ - if (s != NULL && getlogin_r(s, L_cuserid)) - return s; - - return getlogin(); -} - - int setgid(gid_t gid) { From mmu_man at mail.berlios.de Fri Jan 11 14:47:45 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 14:47:45 +0100 Subject: [Haiku-commits] r23395 - in haiku/trunk/src/system/libroot/posix: . unistd Message-ID: <200801111347.m0BDljKs031963@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 14:47:45 +0100 (Fri, 11 Jan 2008) New Revision: 23395 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23395&view=rev Added: haiku/trunk/src/system/libroot/posix/unistd/getlogin.c Modified: haiku/trunk/src/system/libroot/posix/pwd.c haiku/trunk/src/system/libroot/posix/pwd_query.c haiku/trunk/src/system/libroot/posix/unistd/Jamfile Log: Move getlogin*() to its own file and fix the build. This way it doesn't get linked to the kernel. Modified: haiku/trunk/src/system/libroot/posix/pwd.c =================================================================== --- haiku/trunk/src/system/libroot/posix/pwd.c 2008-01-11 13:42:21 UTC (rev 23394) +++ haiku/trunk/src/system/libroot/posix/pwd.c 2008-01-11 13:47:45 UTC (rev 23395) @@ -133,27 +133,3 @@ return 0; } - -char *getlogin() -{ - struct passwd *pw; - pw = getpwuid(getuid()); - if (pw) - return pw->pw_name; - errno = ENOMEM; - return NULL; -} - - -int getlogin_r(char *name, size_t nameSize) -{ - struct passwd *pw; - pw = getpwuid(getuid()); - if (pw && (nameSize > 32/*PW_MAX_NAME*/)) { - memset(name, 0, nameSize); - strlcpy(name, pw->pw_name, 32/*PW_MAX_NAME*/); - return B_OK; - } - return ENOMEM; -} - Modified: haiku/trunk/src/system/libroot/posix/pwd_query.c =================================================================== --- haiku/trunk/src/system/libroot/posix/pwd_query.c 2008-01-11 13:42:21 UTC (rev 23394) +++ haiku/trunk/src/system/libroot/posix/pwd_query.c 2008-01-11 13:47:45 UTC (rev 23395) @@ -621,30 +621,6 @@ } -char *getlogin() -{ - struct passwd *pw; - pw = getpwuid(getuid()); - if (pw) - return pw->pw_name; - errno = ENOMEM; - return NULL; -} - - -int getlogin_r(char *name, size_t nameSize) -{ - struct passwd *pw; - pw = getpwuid(getuid()); - if (pw && (nameSize > 32/*PW_MAX_NAME*/)) { - memset(name, 0, nameSize); - strlcpy(name, pw->pw_name, 32/*PW_MAX_NAME*/); - return B_OK; - } - return ENOMEM; -} - - void __init_pwd_stuff(void) //void _multiuser_init(void) { Modified: haiku/trunk/src/system/libroot/posix/unistd/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/Jamfile 2008-01-11 13:42:21 UTC (rev 23394) +++ haiku/trunk/src/system/libroot/posix/unistd/Jamfile 2008-01-11 13:47:45 UTC (rev 23395) @@ -14,6 +14,7 @@ _exit.c fcntl.c fork.c + getlogin.c hostname.cpp ioctl.c link.c Added: haiku/trunk/src/system/libroot/posix/unistd/getlogin.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/getlogin.c 2008-01-11 13:42:21 UTC (rev 23394) +++ haiku/trunk/src/system/libroot/posix/unistd/getlogin.c 2008-01-11 13:47:45 UTC (rev 23395) @@ -0,0 +1,38 @@ +/* + * Copyright 2002-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include + +#include +#include +#include +#include +#include + + +char *getlogin() +{ + struct passwd *pw; + pw = getpwuid(getuid()); + if (pw) + return pw->pw_name; + errno = ENOMEM; + return NULL; +} + + +int getlogin_r(char *name, size_t nameSize) +{ + struct passwd *pw; + pw = getpwuid(getuid()); + if (pw && (nameSize > 32/*PW_MAX_NAME*/)) { + memset(name, 0, nameSize); + strlcpy(name, pw->pw_name, 32/*PW_MAX_NAME*/); + return B_OK; + } + return ENOMEM; +} + From mmu_man at mail.berlios.de Fri Jan 11 15:33:32 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 15:33:32 +0100 Subject: [Haiku-commits] r23400 - in haiku/trunk/src/apps: . login Message-ID: <200801111433.m0BEXW4c003461@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 15:33:31 +0100 (Fri, 11 Jan 2008) New Revision: 23400 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23400&view=rev Added: haiku/trunk/src/apps/login/ haiku/trunk/src/apps/login/Jamfile haiku/trunk/src/apps/login/Login.rdef haiku/trunk/src/apps/login/LoginApp.cpp haiku/trunk/src/apps/login/LoginApp.h haiku/trunk/src/apps/login/LoginView.cpp haiku/trunk/src/apps/login/LoginView.h haiku/trunk/src/apps/login/LoginWindow.cpp haiku/trunk/src/apps/login/LoginWindow.h haiku/trunk/src/apps/login/main.cpp Log: A simple login app for testing. Added: haiku/trunk/src/apps/login/Jamfile =================================================================== --- haiku/trunk/src/apps/login/Jamfile 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/apps/login/Jamfile 2008-01-11 14:33:31 UTC (rev 23400) @@ -0,0 +1,17 @@ +SubDir HAIKU_TOP src apps login ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +#UsePrivateHeaders shared ; +#UsePrivateHeaders tracker ; +#SubDirHdrs $(HAIKU_TOP) src kits tracker ; + +Application Login : + LoginApp.cpp + LoginWindow.cpp + LoginView.cpp + main.cpp + : be tracker + : Login.rdef + ; + Added: haiku/trunk/src/apps/login/Login.rdef =================================================================== --- haiku/trunk/src/apps/login/Login.rdef 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/apps/login/Login.rdef 2008-01-11 14:33:31 UTC (rev 23400) @@ -0,0 +1,128 @@ + +resource app_signature "application/x-vnd.Haiku-Login"; + +resource app_version { + major = 5, + middle = 2, + minor = 1, + variety = B_APPV_FINAL, + internal = 0, + short_info = "Tracker", + long_info = "Tracker 5.2.1 ?1991-2001 Be, Inc.,\n" + "?2006-2007 Haiku, Inc." +}; + +resource app_flags B_SINGLE_LAUNCH; + +/*resource file_types message { + "types" = "application/x-vnd.Be-symlink", + "types" = "application/x-vnd.Be-directory", + "types" = "application/x-vnd.Be-query", + "types" = "application/x-vnd.Be-volume", + "types" = "application/x-vnd.Be-queryTemplate", + "types" = "application/x-vnd.Be-root", + "types" = "application/x-vnd.Be-elfexecutable", + "types" = "application/x-vnd.Be.printer", + "types" = "application/octet-stream" +};*/ + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + +resource vector_icon { + $"6E636966120500040068020106023ECFFF0000000000003EFFFF486000474000" + $"00DDA771FEA97644020006033C0564379BD6B9B4043E12EF49C94948FD140087" + $"5B2FFFC58A50C4A97644020006023AA0B4B6910F3840E83C4EA54A20CC3C5E02" + $"00F4C597FFDAA47003D7A26E03DAA470020006033AC3B134D937B81B9A3E0BAC" + $"4B13774865BC00C28D59FFB6783BDCA26C3803A4703E020106023B46923A3AF8" + $"BC79A03DA299463C564592D600FDD6ABFFC48B540399632D03F8CCA102000602" + $"38586D38586DB9279239279249CD5B46BF4E00D4975BFFA06F40020016023AA1" + $"AE3A9018BAE9A13AAE8E491D7E4A50B500EDFFA505FF020016023228D0398DC3" + $"BD46803591CA48EEC34A35750091FFB5020016023A05CA3C319CBEA5C93C305F" + $"4A55B949E8F800FFFFE9020006023375F8391697BA971434E7134759DA498BDF" + $"00FFEA00FFFFB83017060BEA4B08335A3D594260525E4B61595B604DCD01C7B3" + $"5E425248464C4C4354380604AE302628262D24B418B63A222E2C2C0A05B639BC" + $"B92B372B36263426350605BA03342E38284030BF44B77141343E3838323A3436" + $"300608EEEE342E38323630BCFBBA973E3840304134BF44B77138284230C027B7" + $"0443363F3A38343A36363206033E5A224A26542A4A264C274C27592C06033BC5" + $"64B639C564B6395A305A22C48AB5CB592CC48AB5CB06156F6BEBB8BC03343038" + $"2A3036303E303A304232445234582A583C583846404A56425E345E4A5E444248" + $"3E4E424C425042525448584E4C4E604E563E545434543854B9B2C564B639C736" + $"B7B45A305A224A26542AC165B4740609BEFB02483E4E3EC431BF54513D523452" + $"36522EC564B639452749263D29353340314031C17ABADA463A4638463C444206" + $"0ADBDA0E4031C17ABADA4031303D3F3541333F37433846404A56425E345E4A5E" + $"4442463A463C46380606B60B32445234582A583C58384635413743333F303F06" + $"0BCFB83C5234522E52364E3E513DC431BF54484E424C425042525448584E4C4E" + $"604E563E545434543854B9B2C564B639C736B7B4C564B6390605BB033430382A" + $"3430353445273DB6954926C564B6394A264A26C165B4740204BE31B7FBBE31B7" + $"FBBE6BB89E3C32BE6EB958BDDCBB0FBC2FBC93BD1EBBE6BC2FBC93352F363135" + $"2F02063426B796B443BC88B5E9BE31B7FB3BB6C6BE31B7FB352F352F3631BC2F" + $"BC93BC2FBC93BADFBD862C3CB92D3C263C2632B4C7BC9D282A0204292CB6CE2C" + $"B65D2C28B8C728B83A28B9532931B65D31B6CE312BB8C72BB9532BB83A020430" + $"30B9D030B8EF302E322EB9BB2EBA9C3034B8EF34B9D034323232BA9C32B9BB0A" + $"06224C385738452C402C3C22380A04223C224C385738450A063451264A244B36" + $"54364634470A06243E244B264A2641344736460A042642264A345134480A0422" + $"38223C2C402C3C190A010100000A0001071001178402040A0200000A03010900" + $"0A020108000A05010A000A07010B000A04010C000A060105000A070106000A00" + $"01011001178402040A0B0101000A00020D0E1001178402040A09010E000A0A01" + $"0D000A000104000A0C0103000A000102000A00020F10000A0001111001178400" + $"040A0D0112000A0E0113000A0F0114000A100115000A11011600" +}; + +#else // HAIKU_TARGET_PLATFORM_HAIKU + +resource large_icon array { + $"FFFF000000FFFFFFFFFFFFFFFFFFFFFF0000000000000000000000FFFFFFFFFF" + $"FF00D9D9D900FFFFFFFFFFFFFFFF0000838383838383008383D9D900FFFFFFFF" + $"00D9D98383000000000000FFFF00838383838383838383010000D9D900FFFFFF" + $"00D9838383D9D9D9D9D9D90000AA00008383D9D9838383AAAA0183D900FFFFFF" + $"00D90083D9D9D983838383D9D900D9D901D9D9D9D9D983AAAA00AAD900FFFFFF" + $"00D900D90000D98383838383D9D9D9D900D9D9D9838383AAAAAA018300FFFFFF" + $"00D900D90083838383000083D90083D983008383838383AAAAAA01AA00FFFFFF" + $"0000D9D98383838383008383D9AA00D983008383838383AAAAAA01AA00FFFFFF" + $"FF0083AAAAAAAAD9D9838383D9AA00D983008383838383AAAAAA01AAD900FFFF" + $"FFAA00AAD983838383D9D9D9D90083D983008383838383AAAAAA01AA83D900FF" + $"FF00D9D98383D98383AAAAD98300D9D983008383830083AAAAAA0100AA83D900" + $"FF00D900D9D9AAAAAAAAAAD9AA00D9D983008383008383AAAAAA01FF00AAAA00" + $"00D9000000AAAAAAAAAAD9AAAA00D983AA0083AA008383AAAAAA00FFFF0000FF" + $"0000D900AAAA00000000D9AA0000AAAA008383AA008383AAAAAA00FFFFFFFFFF" + $"00FA00000000008383AAAA00AAAA0000838300AA00838383AAAAAA00FFFFFFFF" + $"00170FF8F8FA0000000000AAAAAAAAAA838300000083838383AAAA00FFFFFFFF" + $"00170F0F0FF81B000000AAAAAAAA00AA838301FFFF00000000AAAAAA00FFFFFF" + $"00170F3F3F0E0F3F3F3F0000AAAA00AA838300FFFFFFFFFFFF00AAAA00FFFFFF" + $"00170F3F3F3F3F0E0F0F3F1900AAAA00838300FFFFFFFFFFFFFF00AAAA00FFFF" + $"00170F3F3F3F3F3F3F3F0E180000000083AA00FFFFFFFFFFFF00D9AAAA000FFF" + $"00170F3F3F3F3F3F3F3F3F1700FFFF00838300FFFFFFFFFFFF00D9AAAA000F0E" + $"001C173F3F3F3F3F3F3F3F1700FFFF008383AA00FFFFFFFFFF000000000E0F0F" + $"001C17183F3F3F3F3F3F3F1700FFFF008383AA00FFFFFFFFFF0E0F0F0F0F0F0F" + $"00003F3F17173F3F3F3F3F1700FFFF008383AA00FFFFFFFFFFFFFFFFFFFFFFFF" + $"1BFF00003F3F17173F3F3F1700FFFF00838300FFFFFFFFFFFFFFFFFFFFFFFFFF" + $"1B1C00FF00003F3F17173F1700FFFF00838300FFFFFFFFFFFFFFFFFFFFFFFFFF" + $"1B0083AAAA0000003F3F171700FFFF00838300FFFFFFFFFFFFFFFFFFFFFFFFFF" + $"00AAAAAAAA000EFF00003F3F00FF0083838300FFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FF000000000E0F0F0F0F000000FF008383AA000F0F0E0F0F0F0F0FFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFF00FFFF0000000E0F0F0F0F0F0FFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" +}; + +resource mini_icon array { + $"FF0000FFFFFFFFFF000000000000FFFF" + $"00D900000000FF008383D900838300FF" + $"00D98383838300D900D983AA00AA00FF" + $"00D900830083AAD9008383AAAA0000FF" + $"00AAAAAA83830083008383AAAA0000FF" + $"FF00008383AA008300830083AA008300" + $"0000000000AA0000AAAA0083AA000000" + $"00F800000000AAAAD90000D9AA00FFFF" + $"00F8F8F817170000D9000000D9AA01FF" + $"00173F3F3F3F1700D900FFFF00AA00FF" + $"00173F3F3F3F1700D900FFFF00AA000E" + $"00183F3F3F3F17008300FFFF0000000E" + $"0000003F3F3F17008300FFFFFFFFFFFF" + $"FF008300003F17008300FFFFFFFFFFFF" + $"00000000FF000083AA000F0E0F0FFFFF" + $"FFFFFFFFFFFFFF00000E0F0F0FFFFFFF" +}; + +#endif // HAIKU_TARGET_PLATFORM_HAIKU + Added: haiku/trunk/src/apps/login/LoginApp.cpp =================================================================== --- haiku/trunk/src/apps/login/LoginApp.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/apps/login/LoginApp.cpp 2008-01-11 14:33:31 UTC (rev 23400) @@ -0,0 +1,142 @@ +#include + +#include +#include +#include + +#include "LoginApp.h" +#include "LoginWindow.h" + +const char *kLoginAppSig = "application/x-vnd.Haiku-Login"; + + +LoginApp::LoginApp() + : BApplication(kLoginAppSig) +{ +} + + +LoginApp::~LoginApp() +{ +} + + +void +LoginApp::ReadyToRun() +{ + BScreen s; + BRect frame(0, 0, 300, 100); + frame.OffsetBySelf(s.Frame().Width()/2 - frame.Width()/2, + s.Frame().Height()/2 - frame.Height()/2); + LoginWindow *w = new LoginWindow(frame); + w->Show(); +} + + +void +LoginApp::MessageReceived(BMessage *message) +{ + switch (message->what) { + case kMsgOpenFilePanel: + break; + default: + BApplication::MessageReceived(message); + } +} + + void TryLogin(BMessage *message); + status_t ValidateLogin(const char *login, const char *password/*, bool force = false*/); + +void +LoginApp::TryLogin(BMessage *message) +{ + status_t err; + const char *login; + const char *password; + BMessage reply(B_REPLY); + if (message->FindString("login", &login) == B_OK) { + if (message->FindString("password", &password) < B_OK) + password = NULL; + err = ValidateLogin(login, password); + if (err == B_OK) { + reply.AddInt32("error", B_OK); + message->SendReply(reply, NULL); + + if (password == NULL) + return; + + // start a session + //kSetProgress + StartUserSession(login); + } else { + reply.AddInt32("error", err); + message->SendReply(reply, NULL); + return; + } + + } else { + reply.AddInt32("error", EINVAL); + message->SendReply(reply, NULL); + return; + } +} + + +status_t +LoginApp::ValidateLogin(const char *login, const char *password/*, bool force = false*/) +{ + struct passwd *pwd; + + pwd = getpwnam(login); + if (!pwd) + return ENOENT; + if (strcmp(pwd->pw_name, login)) + return ENOENT; + + if (password == NULL) { + // we only want to check is login exists. + return B_OK; + } + + // XXX: check for shadow pass + if (strcmp(crypt(password, pwd->pw_passwd), pwd->pw_passwd)) + return B_NOT_ALLOWED; + + return B_OK; +} + + +status_t +LoginApp::StartUserSession(const char *login) +{ + return B_ERROR; +} + + +int +LoginApp::getpty(char *pty, char *tty) +{ + static const char major[] = "pqrs"; + static const char minor[] = "0123456789abcdef"; + uint32 i, j; + int32 fd = -1; + + for (i = 0; i < sizeof(major); i++) + { + for (j = 0; j < sizeof(minor); j++) + { + sprintf(pty, "/dev/pt/%c%c", major[i], minor[j]); + sprintf(tty, "/dev/tt/%c%c", major[i], minor[j]); + fd = open(pty, O_RDWR|O_NOCTTY); + if (fd >= 0) + { + return fd; + } + } + } + + return fd; +} + + + Added: haiku/trunk/src/apps/login/LoginApp.h =================================================================== --- haiku/trunk/src/apps/login/LoginApp.h 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/apps/login/LoginApp.h 2008-01-11 14:33:31 UTC (rev 23400) @@ -0,0 +1,19 @@ +#include + +/* try loging in a user */ +const uint32 kMsgOpenFilePanel = 'logi'; + +class LoginApp : public BApplication { +public: + LoginApp(); + virtual ~LoginApp(); + void ReadyToRun(); + void MessageReceived(BMessage *message); + +private: + void TryLogin(BMessage *message); + status_t ValidateLogin(const char *login, const char *password/*, bool force = false*/); + status_t StartUserSession(const char *login); + int getpty(char *pty, char *tty); + +}; Added: haiku/trunk/src/apps/login/LoginView.cpp =================================================================== --- haiku/trunk/src/apps/login/LoginView.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/apps/login/LoginView.cpp 2008-01-11 14:33:31 UTC (rev 23400) @@ -0,0 +1,82 @@ +#include + +#include + +#include "LoginView.h" + +#define CSEP 15 + +LoginView::LoginView(BRect frame) + : BView(frame, "LoginView", B_FOLLOW_ALL, 0) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetLowColor(ViewColor()); + BRect r; + r.Set(CSEP, CSEP, 80, Bounds().Height() - 2 * CSEP); + fUserList = new BListView(r, "users"); + BScrollView *sv = new BScrollView("userssv", fUserList); + AddChild(sv); + + r.Set(100, Bounds().top + CSEP, Bounds().right - CSEP, Bounds().top + CSEP + CSEP); + fLoginControl = new BTextControl(r, "login", "login:", "", new BMessage(kLoginEdited)); + AddChild(fLoginControl); + r.OffsetBySelf(0, CSEP + CSEP); + fPasswordControl = new BTextControl(r, "password", "password:", "", new BMessage(kPasswordEdited)); + AddChild(fPasswordControl); + +} + + +LoginView::~LoginView() +{ +} + +void +LoginView::AttachedToWindow() +{ + fLoginControl->MakeFocus(); + // populate user list + BMessenger(this).SendMessage(kAddNextUser); +} + + +void +LoginView::MessageReceived(BMessage *message) +{ + switch (message->what) { + case kSetProgress: + break; + case kAddNextUser: + AddNextUser(); + break; + default: + BView::MessageReceived(message); + } +} + + +void +LoginView::AddNextUser() +{ + struct passwd *pwd; + if (fUserList->CountItems() < 1) + setpwent(); + + pwd = getpwent(); + + if (pwd && pwd->pw_shell && + strcmp(pwd->pw_shell, "false") && + strcmp(pwd->pw_shell, "true") && + strcmp(pwd->pw_shell, "/bin/false") && + strcmp(pwd->pw_shell, "/bin/true")) { + // not disabled + BStringItem *item = new BStringItem(pwd->pw_name); + fUserList->AddItem(item); + } + if (pwd) + BMessenger(this).SendMessage(kAddNextUser); + else + endpwent(); +} + + Added: haiku/trunk/src/apps/login/LoginView.h =================================================================== --- haiku/trunk/src/apps/login/LoginView.h 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/apps/login/LoginView.h 2008-01-11 14:33:31 UTC (rev 23400) @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +const uint32 kLoginEdited = 'logc'; +const uint32 kPasswordEdited = 'pasc'; +const uint32 kAddNextUser = 'adnu'; +const uint32 kSetProgress = 'setp'; + +class LoginView : public BView { + public: + LoginView(BRect frame); + virtual ~LoginView(); + void AttachedToWindow(); + void MessageReceived(BMessage *message); + private: + void AddNextUser(); + BTextControl *fLoginControl; + BTextControl *fPasswordControl; + BListView *fUserList; +}; + Added: haiku/trunk/src/apps/login/LoginWindow.cpp =================================================================== --- haiku/trunk/src/apps/login/LoginWindow.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/apps/login/LoginWindow.cpp 2008-01-11 14:33:31 UTC (rev 23400) @@ -0,0 +1,19 @@ +#include "LoginWindow.h" +#include "LoginView.h" + +LoginWindow::LoginWindow(BRect frame) + : BWindow(frame, /*"Login"*/"Welcome to Haiku", B_TITLED_WINDOW_LOOK, + B_NORMAL_WINDOW_FEEL/*B_FLOATING_ALL_WINDOW_FEEL*/, + B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | + B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS) +{ + LoginView *v = new LoginView(Bounds()); + AddChild(v); +} + + +LoginWindow::~LoginWindow() +{ +} + + Added: haiku/trunk/src/apps/login/LoginWindow.h =================================================================== --- haiku/trunk/src/apps/login/LoginWindow.h 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/apps/login/LoginWindow.h 2008-01-11 14:33:31 UTC (rev 23400) @@ -0,0 +1,8 @@ +#include + +class LoginWindow : public BWindow { +public: + LoginWindow(BRect frame); +virtual ~LoginWindow(); +}; + Added: haiku/trunk/src/apps/login/main.cpp =================================================================== --- haiku/trunk/src/apps/login/main.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/apps/login/main.cpp 2008-01-11 14:33:31 UTC (rev 23400) @@ -0,0 +1,9 @@ +#include "LoginApp.h" + +int main(int , char **) +{ + LoginApp app; + app.Run(); + + return 0; +} From mmu_man at mail.berlios.de Fri Jan 11 15:34:24 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 15:34:24 +0100 Subject: [Haiku-commits] r23401 - haiku/trunk/src/apps Message-ID: <200801111434.m0BEYOT3003588@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 15:34:23 +0100 (Fri, 11 Jan 2008) New Revision: 23401 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23401&view=rev Modified: haiku/trunk/src/apps/Jamfile Log: Add Login to the build. Modified: haiku/trunk/src/apps/Jamfile =================================================================== --- haiku/trunk/src/apps/Jamfile 2008-01-11 14:33:31 UTC (rev 23400) +++ haiku/trunk/src/apps/Jamfile 2008-01-11 14:34:23 UTC (rev 23401) @@ -16,6 +16,7 @@ SubInclude HAIKU_TOP src apps icon-o-matic ; SubInclude HAIKU_TOP src apps installer ; SubInclude HAIKU_TOP src apps launchbox ; +SubInclude HAIKU_TOP src apps login ; SubInclude HAIKU_TOP src apps magnify ; SubInclude HAIKU_TOP src apps mail ; SubInclude HAIKU_TOP src apps mandelbrot ; From mmu_man at mail.berlios.de Fri Jan 11 17:07:31 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 17:07:31 +0100 Subject: [Haiku-commits] r23402 - haiku/trunk/src/apps/login Message-ID: <200801111607.m0BG7ViL012998@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 17:07:30 +0100 (Fri, 11 Jan 2008) New Revision: 23402 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23402&view=rev Modified: haiku/trunk/src/apps/login/LoginApp.cpp Log: Fix Haiku build. Modified: haiku/trunk/src/apps/login/LoginApp.cpp =================================================================== --- haiku/trunk/src/apps/login/LoginApp.cpp 2008-01-11 14:34:23 UTC (rev 23401) +++ haiku/trunk/src/apps/login/LoginApp.cpp 2008-01-11 16:07:30 UTC (rev 23402) @@ -60,7 +60,7 @@ err = ValidateLogin(login, password); if (err == B_OK) { reply.AddInt32("error", B_OK); - message->SendReply(reply, NULL); + message->SendReply(&reply); if (password == NULL) return; @@ -70,13 +70,13 @@ StartUserSession(login); } else { reply.AddInt32("error", err); - message->SendReply(reply, NULL); + message->SendReply(&reply); return; } } else { reply.AddInt32("error", EINVAL); - message->SendReply(reply, NULL); + message->SendReply(&reply); return; } } From stippi at mail.berlios.de Fri Jan 11 17:13:02 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 11 Jan 2008 17:13:02 +0100 Subject: [Haiku-commits] r23403 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200801111613.m0BGD25h013502@sheep.berlios.de> Author: stippi Date: 2008-01-11 17:13:01 +0100 (Fri, 11 Jan 2008) New Revision: 23403 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23403&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c Log: * init the repeat timer values, if the timeout happend to be low enough and you never pressed any key on the usb keyboard, you could suddenly be flooded with a random key... Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-11 16:07:30 UTC (rev 23402) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-11 16:13:01 UTC (rev 23403) @@ -352,6 +352,9 @@ device->last_click_time = 0; device->last_buttons = 0; + device->repeat_timer.current_delay = B_INFINITE_TIMEOUT; + device->repeat_timer.key = 0; + // default values taken from the PS/2 driver device->repeat_rate = 35000; device->repeat_delay = 300000; From colacoder at mail.berlios.de Fri Jan 11 17:50:53 2008 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Fri, 11 Jan 2008 17:50:53 +0100 Subject: [Haiku-commits] r23404 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200801111650.m0BGorK5016976@sheep.berlios.de> Author: colacoder Date: 2008-01-11 17:50:53 +0100 (Fri, 11 Jan 2008) New Revision: 23404 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23404&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.c haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.c haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.c haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.c Log: Some minor fixes; lots of debugging output still in there; not perfect yet Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.c 2008-01-11 16:13:01 UTC (rev 23403) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.c 2008-01-11 16:50:53 UTC (rev 23404) @@ -74,6 +74,7 @@ uninit_driver (void) { long i; + dprintf("IRA: %s\n", __func__); for (i=0; i < num_cards; i++) { free((void*)cards[i].devfs_path); cards[i].devfs_path = NULL; @@ -91,6 +92,7 @@ static const char* devs[MAXCARDS+1]; long i; + dprintf("IRA: %s\n", __func__); for (i=0; i < num_cards; i++) devs[i] = cards[i].devfs_path; @@ -102,5 +104,6 @@ device_hooks* find_device(const char* name) { + dprintf("IRA: %s\n", __func__); return &driver_hooks; } Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h 2008-01-11 16:13:01 UTC (rev 23403) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h 2008-01-11 16:50:53 UTC (rev 23404) @@ -22,13 +22,13 @@ #define MAXCARDS 4 /* values for the class_sub field for class_base = 0x04 (multimedia device) */ -#define PCI_hd_audio 3 +#define PCI_hd_audio 3 -#define HDA_MAXAFGS 15 +#define HDA_MAXAFGS 15 #define HDA_MAXCODECS 15 #define HDA_MAXSTREAMS 16 #define MAX_CODEC_RESPONSES 10 -#define MAXINPUTS 32 +#define MAXINPUTS 32 /* FIXME: Find out why we need so much! */ #define DEFAULT_FRAMESPERBUF 4096 @@ -52,31 +52,33 @@ */ typedef struct hda_stream_info_s { - uint32 id; /* HDA controller stream # */ - uint32 off; /* HDA I/O/B descriptor offset */ - bool running; /* Is this stream active? */ - spinlock lock; /* Write lock */ - - uint32 pin_wid; /* PIN Widget ID */ - uint32 io_wid; /* Input/Output Converter Widget ID */ + uint32 id; /* HDA controller stream # */ + uint32 off; /* HDA I/O/B descriptor offset */ + bool running; /* Is this stream active? */ + spinlock lock; /* Write lock */ + uint32 pin_wid; /* PIN Widget ID */ + uint32 io_wid; /* Input/Output Converter Widget ID */ + uint32 samplerate; uint32 sampleformat; - + uint32 num_buffers; uint32 num_channels; uint32 buffer_length; /* size of buffer in samples */ uint32 sample_size; void* buffers[STRMAXBUF]; /* Virtual addresses for buffer */ - uint32 buffers_pa[STRMAXBUF]; /* Physical addresses for buffer */ + uint32 buffers_pa[STRMAXBUF]; /* Physical addresses for buffer */ sem_id buffer_ready_sem; bigtime_t real_time; uint32 frames_count; uint32 buffer_cycle; + uint32 rate, bps; /* Samplerate & bits per sample */ + area_id buffer_area; area_id bdl_area; - uint32 bdl_pa; /* BDL physical address */ + uint32 bdl_pa; /* BDL physical address */ } hda_stream; /* hda_afg @@ -96,12 +98,12 @@ uint32 root_nid, - wid_start, - wid_count; + wid_start, + wid_count; uint32 deffmts, - defrates, - defpm; + defrates, + defpm; struct { uint32 num_inputs; @@ -124,8 +126,8 @@ struct { } mixer; struct { - uint32 output; - uint32 input; + uint32 output; + uint32 input; pin_dev_type device; } pin; } d; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.c 2008-01-11 16:13:01 UTC (rev 23403) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.c 2008-01-11 16:50:53 UTC (rev 23404) @@ -74,8 +74,8 @@ if (resp[1] & (1<<20)) *fmts |= B_FMT_32BIT; } - if (resp[0] & (1 << 1)) *fmts |= B_FMT_FLOAT; - if (resp[0] & (1 << 2)) /* Sort out how to handle AC3 */; +//FIXME: if (resp[0] & (1 << 1)) *fmts |= B_FMT_FLOAT; +//FIXME: if (resp[0] & (1 << 2)) /* Sort out how to handle AC3 */; } return rc; @@ -147,7 +147,17 @@ off = 0; if (resp[0] & (1 << 11)) off += sprintf(buf+off, "[L-R Swap] "); - if (resp[0] & (1 << 10)) off += sprintf(buf+off, "[Power] "); + if (resp[0] & (1 << 10)) { + corb_t verb; + uint32 resp; + + off += sprintf(buf+off, "[Power] "); + + /* We support power; switch us on! */ + verb = MAKE_VERB(afg->codec->addr,wid,VID_SET_POWERSTATE,0); + hda_send_verbs(afg->codec, &verb, &resp, 1); + } + if (resp[0] & (1 << 9)) off += sprintf(buf+off, "[Digital] "); if (resp[0] & (1 << 7)) off += sprintf(buf+off, "[Unsol Capable] "); if (resp[0] & (1 << 6)) off += sprintf(buf+off, "[Proc Widget] "); @@ -354,20 +364,16 @@ we cannot find any output Pin Widgets */ rc = ENODEV; - dprintf("%s: Scanning all %ld widgets for outputs/inputs....\n", - __func__, afg->wid_count); - /* Try to locate all input/output channels */ for (idx=0; idx < afg->wid_count; idx++) { uint32 output_wid = 0, input_wid = 0; int32 iidx; - if (afg->widgets[idx].type == WT_PIN_COMPLEX && afg->widgets[idx].d.pin.output) { - if (afg->widgets[idx].d.pin.device != PIN_DEV_HP_OUT && - afg->widgets[idx].d.pin.device != PIN_DEV_SPEAKER && - afg->widgets[idx].d.pin.device != PIN_DEV_LINE_OUT) - continue; - + if (afg->playback_stream == NULL && afg->widgets[idx].type == WT_PIN_COMPLEX && afg->widgets[idx].d.pin.output) { + if (afg->widgets[idx].d.pin.device == PIN_DEV_HP_OUT || + afg->widgets[idx].d.pin.device == PIN_DEV_SPEAKER || + afg->widgets[idx].d.pin.device == PIN_DEV_LINE_OUT) + { iidx = afg->widgets[idx].active_input; if (iidx != -1) { output_wid = hda_codec_afg_find_path(afg, afg->widgets[idx].inputs[iidx], WT_AUDIO_OUTPUT, 0); @@ -385,7 +391,7 @@ if (output_wid) { if (!afg->playback_stream) { - corb_t verb; + corb_t verb[2]; /* Setup playback/record streams for Multi Audio API */ afg->playback_stream = hda_stream_new(afg->codec->ctrlr, STRM_PLAYBACK); @@ -394,16 +400,19 @@ afg->playback_stream->pin_wid = idx + afg->wid_start; afg->playback_stream->io_wid = output_wid; - /* FIXME: Force Pin Widget to unmute */ - verb = MAKE_VERB(codec->addr, afg->playback_stream->pin_wid, + /* FIXME: Force Pin Widget to unmute; enable hp/output */ + verb[0] = MAKE_VERB(codec->addr, afg->playback_stream->pin_wid, VID_SET_AMPGAINMUTE, (1 << 15) | (1 << 13) | (1 << 12)); - hda_send_verbs(codec, &verb, NULL, 1); + verb[1] = MAKE_VERB(codec->addr, afg->playback_stream->pin_wid, + VID_SET_PINWCTRL, (1 << 7) | (1 << 6)); + hda_send_verbs(codec, verb, NULL, 2); + + dprintf("%s: Found output PIN (%s) connected to output CONV wid:%ld\n", + __func__, defdev[afg->widgets[idx].d.pin.device], output_wid); } - - dprintf("%s: Found output PIN (%s) connected to output CONV wid:%ld\n", - __func__, defdev[afg->widgets[idx].d.pin.device], output_wid); } - } + } + } if (afg->widgets[idx].type == WT_AUDIO_INPUT) { iidx = afg->widgets[idx].active_input; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.c 2008-01-11 16:13:01 UTC (rev 23403) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.c 2008-01-11 16:50:53 UTC (rev 23404) @@ -183,38 +183,41 @@ dprintf("%s(%s): Allocated %ld bytes for %ld BDLEs\n", __func__, desc, alloc, s->num_buffers); - + /* Setup BDL entries */ for (idx=0; idx < s->num_buffers; idx++, bdl++) { - bdl->address = buffer_pa + (idx*buffer_size); - bdl->length = s->sample_size * s->num_channels * s->buffer_length; + bdl->address = s->buffers_pa[idx]; + bdl->length = buffer_size; bdl->ioc = 1; } /* Configure stream registers */ wfmt = s->num_channels -1; switch(s->sampleformat) { - case B_FMT_8BIT_S: wfmt |= (0 << 4); break; - case B_FMT_16BIT: wfmt |= (1 << 4); break; - case B_FMT_24BIT: wfmt |= (3 << 4); break; - case B_FMT_32BIT: wfmt |= (4 << 4); break; - default: dprintf("%s: Invalid sample format: 0x%lx\n", __func__, s->sampleformat); break; + case B_FMT_8BIT_S: wfmt |= (0 << 4); s->bps = 8; break; + case B_FMT_16BIT: wfmt |= (1 << 4); s->bps = 16; break; + case B_FMT_24BIT: wfmt |= (3 << 4); s->bps = 24; break; + case B_FMT_32BIT: wfmt |= (4 << 4); s->bps = 32; break; + default: dprintf("%s: Invalid sample format: 0x%lx\n", __func__, s->sampleformat); break; } + switch(s->samplerate) { - case B_SR_8000: wfmt |= (7 << 8); break; - case B_SR_11025: wfmt |= (67 << 8); break; - case B_SR_16000: wfmt |= (2 << 8); break; - case B_SR_22050: wfmt |= (65 << 8); break; - case B_SR_32000: wfmt |= (10 << 8); break; - case B_SR_44100: wfmt |= (64 << 8); break; - case B_SR_48000: wfmt |= (0 << 8); break; - case B_SR_88200: wfmt |= (72 << 8); break; - case B_SR_96000: wfmt |= (8 << 8); break; - case B_SR_176400: wfmt |= (88 << 8); break; - case B_SR_192000: wfmt |= (24 << 8); break; - default: dprintf("%s: Invalid sample rate: 0x%lx\n", __func__, s->samplerate); break; + case B_SR_8000: wfmt |= (0 << 14) | (0 << 11) | (5 << 8); s->rate=8000; break; + case B_SR_11025: wfmt |= (1 << 14) | (0 << 11) | (3 << 8); s->rate=11025; break; + case B_SR_16000: wfmt |= (0 << 14) | (0 << 11) | (2 << 8); s->rate=16000; break; + case B_SR_22050: wfmt |= (1 << 14) | (0 << 11) | (1 << 8); s->rate=22050; break; + case B_SR_32000: wfmt |= (0 << 14) | (1 << 11) | (2 << 8); s->rate=32000; break; + case B_SR_44100: wfmt |= (1 << 14) | (0 << 11) | (0 << 8); s->rate=44100; break; + case B_SR_48000: wfmt |= (0 << 14) | (0 << 11) | (0 << 8); s->rate=48000; break; + case B_SR_88200: wfmt |= (1 << 14) | (1 << 11) | (0 << 8); s->rate=88200; break; + case B_SR_96000: wfmt |= (0 << 14) | (2 << 11) | (0 << 8); s->rate=96000; break; + case B_SR_176400: wfmt |= (1 << 14) | (3 << 11) | (0 << 8); s->rate=176400; break; + case B_SR_192000: wfmt |= (0 << 14) | (3 << 11) | (0 << 8); s->rate=192000; break; + default: dprintf("%s: Invalid sample rate: 0x%lx\n", __func__, s->samplerate); break; } + dprintf("IRA: %s: setup stream %ld: SR=%ld, SF=%ld\n", __func__, s->id, s->rate, s->bps); + OREG16(afg->codec->ctrlr,s->off,FMT) = wfmt; OREG32(afg->codec->ctrlr,s->off,BDPL) = s->bdl_pa; OREG32(afg->codec->ctrlr,s->off,BDPU) = 0; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.c 2008-01-11 16:13:01 UTC (rev 23403) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.c 2008-01-11 16:50:53 UTC (rev 23404) @@ -173,7 +173,7 @@ /* ... from here on, we can assume again that a reasonable request is being made */ - data->flags = 0; + data->flags = B_MULTI_BUFFER_PLAYBACK; /* Copy the requested settings into the streams */ afg->playback_stream->num_buffers = data->request_playback_buffers; @@ -218,6 +218,8 @@ return B_OK; } +/* playback_buffer_cycle is the buffer we want to have played */ + static status_t buffer_exchange(hda_afg* afg, multi_buffer_info* data) { @@ -258,7 +260,7 @@ buffer_force_stop(hda_afg* afg) { hda_stream_stop(afg->codec->ctrlr, afg->playback_stream); - hda_stream_stop(afg->codec->ctrlr, afg->record_stream); + //hda_stream_stop(afg->codec->ctrlr, afg->record_stream); delete_sem(afg->playback_stream->buffer_ready_sem); // delete_sem(afg->record_stream->buffer_ready_sem); From mmlr at mail.berlios.de Fri Jan 11 18:06:28 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 11 Jan 2008 18:06:28 +0100 Subject: [Haiku-commits] r23405 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200801111706.m0BH6Swd018239@sheep.berlios.de> Author: mmlr Date: 2008-01-11 18:06:27 +0100 (Fri, 11 Jan 2008) New Revision: 23405 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23405&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.c Log: Reset the control count so the hmulti_audio does not try to read them. Fixes crash when using hda with hmulti_audio under R5. Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.c 2008-01-11 16:50:53 UTC (rev 23404) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.c 2008-01-11 17:06:27 UTC (rev 23405) @@ -124,6 +124,7 @@ static status_t list_mix_controls(hda_afg* afg, multi_mix_control_info * data) { + data->control_count = 0; return B_OK; } From mmu_man at mail.berlios.de Fri Jan 11 19:06:21 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 19:06:21 +0100 Subject: [Haiku-commits] r23406 - in haiku/trunk/3rdparty: . themes themes/addons Message-ID: <200801111806.m0BI6Lnn006927@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 19:06:15 +0100 (Fri, 11 Jan 2008) New Revision: 23406 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23406&view=rev Added: haiku/trunk/3rdparty/themes/ haiku/trunk/3rdparty/themes/CompareMessages.cpp haiku/trunk/3rdparty/themes/DumpMessage.cpp haiku/trunk/3rdparty/themes/DumpMessage.h haiku/trunk/3rdparty/themes/FileUtils.cpp haiku/trunk/3rdparty/themes/FileUtils.h haiku/trunk/3rdparty/themes/Jamfile haiku/trunk/3rdparty/themes/MakeScreenshot.cpp haiku/trunk/3rdparty/themes/ParseMessage.cpp haiku/trunk/3rdparty/themes/ParseMessage.h haiku/trunk/3rdparty/themes/ThemeAddonItem.cpp haiku/trunk/3rdparty/themes/ThemeAddonItem.h haiku/trunk/3rdparty/themes/ThemeInterfaceView.cpp haiku/trunk/3rdparty/themes/ThemeInterfaceView.h haiku/trunk/3rdparty/themes/ThemeItem.cpp haiku/trunk/3rdparty/themes/ThemeItem.h haiku/trunk/3rdparty/themes/ThemeManager.cpp haiku/trunk/3rdparty/themes/ThemeManager.h haiku/trunk/3rdparty/themes/Themes.rdef haiku/trunk/3rdparty/themes/ThemesAddon.cpp haiku/trunk/3rdparty/themes/ThemesAddon.h haiku/trunk/3rdparty/themes/UITheme.h haiku/trunk/3rdparty/themes/ViewItem.cpp haiku/trunk/3rdparty/themes/ViewItem.h haiku/trunk/3rdparty/themes/addons/ haiku/trunk/3rdparty/themes/addons/BackgroundsAddon.cpp haiku/trunk/3rdparty/themes/addons/BeIDEAddon.cpp haiku/trunk/3rdparty/themes/addons/DanoWindowDecorAddon.cpp haiku/trunk/3rdparty/themes/addons/DeskbarAddon.cpp haiku/trunk/3rdparty/themes/addons/EddieAddon.cpp haiku/trunk/3rdparty/themes/addons/PeAddon.cpp haiku/trunk/3rdparty/themes/addons/ScreensaverAddon.cpp haiku/trunk/3rdparty/themes/addons/SoundplayColorAddon.cpp haiku/trunk/3rdparty/themes/addons/SoundsAddon.cpp haiku/trunk/3rdparty/themes/addons/TerminalAddon.cpp haiku/trunk/3rdparty/themes/addons/UISettingsAddon.cpp haiku/trunk/3rdparty/themes/addons/WinampSkinAddon.cpp Log: The current version of the Theme Manager I wrote for zeta (yes I own that code, I wasn't asked for it in the first place, it only got some small changes). Missing ThemesPopupText stuff I used from zeta, will write a better, BAlert based one anyway. Still needs a container app an Haiku support. Added: haiku/trunk/3rdparty/themes/CompareMessages.cpp =================================================================== --- haiku/trunk/3rdparty/themes/CompareMessages.cpp 2008-01-11 17:06:27 UTC (rev 23405) +++ haiku/trunk/3rdparty/themes/CompareMessages.cpp 2008-01-11 18:06:15 UTC (rev 23406) @@ -0,0 +1,46 @@ +/* + * function to compare 2 BMessages + */ +#include + +#include + +/* returns true if == */ +bool CompareMessages(BMessage &a, BMessage &b) +{ + void *cookie = NULL; + const char *name; + type_code code; + int32 count, i; + const void *adata, *bdata; + ssize_t asize, bsize; + + if (a.what != b.what) + return false; + while (a.GetNextName(&cookie, &name, &code, &count) == B_OK) { + for (i = 0; i < count; i++) { + if (a.FindData(name, code, i, &adata, &asize) != B_OK) + return false; + if (b.FindData(name, code, i, &bdata, &bsize) != B_OK) + return false; + if (asize != bsize) + return false; + if (memcmp(adata, bdata, asize)) + return false; + } + } + cookie = NULL; + /* cross compare */ + while (b.GetNextName(&cookie, &name, &code, &count) == B_OK) { + type_code acode; + int32 acount; + if (a.GetInfo(name, &acode, &acount) < B_OK) + return false; + if (code != acode) + return false; + if (count != acount) + return false; + } + return true; +} + Added: haiku/trunk/3rdparty/themes/DumpMessage.cpp =================================================================== --- haiku/trunk/3rdparty/themes/DumpMessage.cpp 2008-01-11 17:06:27 UTC (rev 23405) +++ haiku/trunk/3rdparty/themes/DumpMessage.cpp 2008-01-11 18:06:15 UTC (rev 23406) @@ -0,0 +1,237 @@ +#include +#include +#include +#include +#include +#include +#include "DumpMessage.h" + +//#define WHAT_ALWAYS_HEX 1 + +const char *msg_header_comment = "// new BMessage\n"; // avoids mime to think it's a .bmp ("BM") + +status_t HexDumpToStream(const void *data, size_t len, BDataIO &stream, const char *prefix = NULL) +{ + const unsigned char *p = (unsigned char *)data; + char buffer[100]; + size_t i, j; + for (i=0; i= len) + sprintf(buffer, " "); + //else if (p[i+j] < 255 && p[i+j] >= 0x20) + else if (isalpha(p[i+j])) + sprintf(buffer, "%c", p[i+j]); + else + sprintf(buffer, "."); + stream.Write(buffer, 1); + } + sprintf(buffer, "'\n"); + stream.Write(buffer, strlen(buffer)); + } + return B_OK; +} + +/* look up human readable names from an other BMessage */ +bool LookUpFieldName(const char **name, const char *field_name, BMessage *names) +{ + if (names == NULL) + return false; + if (names->FindString(field_name, name) == B_OK) + return true; + return false; +} + +status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, BMessage *names) +{ + int32 index; + void *cookie = NULL; + const char *field_name; + type_code field_code; + int32 field_count; + char buffer[80]; + char tabs[20]; + const char *easy_name; + + if (message == NULL) + return EINVAL; + + if (tabCount < 1) + stream.Write(msg_header_comment, strlen(msg_header_comment)); + + memset(tabs, '\t', (++tabCount) + 1); + tabs[tabCount+1] = '\0'; + //tabCount; + +#ifndef WHAT_ALWAYS_HEX + if ( isalnum(message->what & 0x0ff) && + isalnum((message->what >> 8) & 0x0ff) && + isalnum((message->what >> 16) & 0x0ff) && + isalnum((message->what >> 24) & 0x0ff)) + sprintf(buffer, "BMessage('%c%c%c%c') {\n", + (char)(message->what >> 24) & 0x0ff, + (char)(message->what >> 16) & 0x0ff, + (char)(message->what >> 8) & 0x0ff, + (char)message->what & 0x0ff); + else +#endif + sprintf(buffer, "BMessage(0x%08lx) {\n", message->what); +// stream.Write(tabs+2, tabCount-2); + stream.Write(buffer, strlen(buffer)); + + while (message->GetNextName(&cookie, + &field_name, + &field_code, + &field_count) == B_OK) { + if (LookUpFieldName(&easy_name, field_name, names)) { + stream.Write(tabs+1, tabCount); + stream.Write("// ", 3); + stream.Write(easy_name, strlen(easy_name)); + stream.Write("\n", 1); + } + + for (index=0; index < field_count; index++) { + stream.Write(tabs+1, tabCount); + stream.Write(field_name, strlen(field_name)); + if (field_count > 1) { + sprintf(buffer, "[%ld]", index); + stream.Write(buffer, strlen(buffer)); + } + stream.Write(" = ", 3); + + switch (field_code) { + case 'MSGG': + { + BMessage m; + if (message->FindMessage(field_name, index, &m) >= B_OK) + DumpMessageToStream(&m, stream, tabCount, names); + } + break; + case 'FONt': + { + BFont f; + if (message->FindFlat(field_name, index, &f) >= B_OK) + stream << f; + stream.Write("\n", 1); + } + break; + case B_RGB_COLOR_TYPE: + { + rgb_color c; + if (message->FindRGBColor(field_name, index, &c) >= B_OK) { + sprintf(buffer, "rgb_color(%d,%d,%d,%d)", + c.red, c.green, c.blue, c.alpha); + stream.Write(buffer, strlen(buffer)); + } + stream.Write("\n", 1); + } + break; + case B_BOOL_TYPE: + { + bool value; + if (message->FindBool(field_name, index, &value) >= B_OK) { + sprintf(buffer, "bool(%s)", value?"true":"false"); + stream.Write(buffer, strlen(buffer)); + } + stream.Write("\n", 1); + } + break; + case B_INT32_TYPE: + { + int32 value; + if (message->FindInt32(field_name, index, &value) >= B_OK) { +#if 1 + if (value == 0) + sprintf(buffer, "int32(0 or (nil))"); + else +#endif +// sprintf(buffer, "int32(%d)", value); + sprintf(buffer, "int32(%ld or 0x%lx)", value, value); + stream.Write(buffer, strlen(buffer)); + } + stream.Write("\n", 1); + } + break; + case B_FLOAT_TYPE: + { + float value; + if (message->FindFloat(field_name, index, &value) >= B_OK) { + sprintf(buffer, "float(%f)", value); + stream.Write(buffer, strlen(buffer)); + } + stream.Write("\n", 1); + } + break; + case B_STRING_TYPE: + { + const char *value; + if (message->FindString(field_name, index, &value) >= B_OK) { + BString str(value); + str.CharacterEscape("\\\"\n", '\\'); + //sprintf(buffer, "string(\"%s\", %ld bytes)", str.String(), strlen(value)); + // DO NOT use buffer! + str.Prepend("string(\""); + str << "\", " << strlen(value) << " bytes)"; + stream.Write(str.String(), strlen(str.String())); + } + stream.Write("\n", 1); + } + break; + case B_POINT_TYPE: + { + BPoint value; + if (message->FindPoint(field_name, index, &value) >= B_OK) { + sprintf(buffer, "BPoint(%1.1f, %1.1f)", value.x, value.y); + stream.Write(buffer, strlen(buffer)); + } + stream.Write("\n", 1); + } + break; + default: + { + const void *data; + ssize_t numBytes = 0; + if (message->FindData(field_name, field_code, index, &data, &numBytes) != B_OK) { + //stream.Write("\n", 1); + break; + } + + if ( isalnum(field_code & 0x0ff) && + isalnum((field_code >> 8) & 0x0ff) && + isalnum((field_code >> 16) & 0x0ff) && + isalnum((field_code >> 24) & 0x0ff)) + sprintf(buffer, "'%c%c%c%c' %ld bytes:\n", + (char)(field_code >> 24) & 0x0ff, + (char)(field_code >> 16) & 0x0ff, + (char)(field_code >> 8) & 0x0ff, + (char)field_code & 0x0ff, + numBytes); + else + sprintf(buffer, "0x%08lx %ld bytes:\n", field_code, numBytes); + stream.Write(buffer, strlen(buffer)); + stream.Write("\n", 1); + HexDumpToStream(data, numBytes, stream, tabs); + } + break; + } + } + } + stream.Write(tabs+2, tabCount-1); + stream.Write("}\n", 2); + return B_OK; +} + Added: haiku/trunk/3rdparty/themes/DumpMessage.h =================================================================== --- haiku/trunk/3rdparty/themes/DumpMessage.h 2008-01-11 17:06:27 UTC (rev 23405) +++ haiku/trunk/3rdparty/themes/DumpMessage.h 2008-01-11 18:06:15 UTC (rev 23406) @@ -0,0 +1,10 @@ +#ifndef _DUMP_MESSAGE_H +#define _DUMP_MESSAGE_H + +class BMessage; +class BDataIO; + +status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount = 0, BMessage *names = NULL); + +#endif /* _DUMP_MESSAGE_H */ + Added: haiku/trunk/3rdparty/themes/FileUtils.cpp =================================================================== --- haiku/trunk/3rdparty/themes/FileUtils.cpp 2008-01-11 17:06:27 UTC (rev 23405) +++ haiku/trunk/3rdparty/themes/FileUtils.cpp 2008-01-11 18:06:15 UTC (rev 23406) @@ -0,0 +1,272 @@ +#include "FileUtils.h" +#include +#include +#include +#include +#include + + +// some private font information structs +namespace BPrivate { + +typedef struct font_folder_info { + //char name[256]; + char *name; + uint32 flags; +} font_folder_info; +typedef struct font_file_info { + char *name; + uint32 flags; + font_family family; + font_style style; + uint32 dummy; +} font_file_info; + +}; + +using namespace BPrivate; + +// this is PRIVATE to libbe and NOT in R5!!! +extern long _count_font_folders_(void); +extern long _count_font_files_(long); +extern status_t _get_nth_font_file_(long, font_file_info **); +extern status_t _get_nth_font_folder_(long, font_folder_info **); + +status_t find_font_file(entry_ref *to, font_family family, font_style style, float size) +{ + status_t err; + long i, fontcount, foldercount; + font_file_info *ffi; + font_folder_info *fdi; + bool found = false; + (void)size; + + fontcount = _count_font_files_(0); + for (i = 0; i < fontcount; i++) { + err = _get_nth_font_file_(i, &ffi); + if (err) + continue; + if (strcmp(ffi->family, family) || strcmp(ffi->style, style)) + continue; + found = true; + break; + } + if (!found) + return ENOENT; + foldercount = _count_font_folders_(); + for (i = 0; i < fontcount; i++) { + err = _get_nth_font_folder_(i, &fdi); + if (err) + continue; + BPath ffile(fdi->name); + ffile.Append(ffi->name); + printf("find_font_file: looking for '%s' in '%s'\n", ffi->name, fdi->name); + BEntry ent(ffile.Path()); + if (ent.InitCheck()) + continue; + printf("find_font_file: found\n."); + return ent.GetRef(to); + } + return ENOENT; +} + +#define _BORK(_t) \ + err = find_directory(_t, &path); \ + if (!err && (s = dir->FindFirst(path.Path())) >= 0) { \ + printf("found %s\n", #_t); \ + dir->Remove(s, strlen(path.Path()) - s); \ + BString tok(#_t); \ + tok.Prepend("${"); \ + tok.Append("}"); \ + dir->Insert(tok, s); \ + return B_OK; \ + } \ + +status_t escape_find_directory(BString *dir) +{ + status_t err; + BPath path; + int32 s; + + _BORK(B_DESKTOP_DIRECTORY); + _BORK(B_TRASH_DIRECTORY); + //_BORK(B_ROOT_DIRECTORY); + + //_BORK(B_BEOS_BOOT_DIRECTORY); + _BORK(B_BEOS_FONTS_DIRECTORY); + _BORK(B_BEOS_LIB_DIRECTORY); + _BORK(B_BEOS_SERVERS_DIRECTORY); + _BORK(B_BEOS_APPS_DIRECTORY); + _BORK(B_BEOS_BIN_DIRECTORY); + _BORK(B_BEOS_ETC_DIRECTORY); + _BORK(B_BEOS_DOCUMENTATION_DIRECTORY); + _BORK(B_BEOS_PREFERENCES_DIRECTORY); + _BORK(B_BEOS_TRANSLATORS_DIRECTORY); + _BORK(B_BEOS_MEDIA_NODES_DIRECTORY); + _BORK(B_BEOS_SOUNDS_DIRECTORY); + // not in the declared order, so others are picked first + _BORK(B_BEOS_ADDONS_DIRECTORY); + _BORK(B_BEOS_SYSTEM_DIRECTORY); + _BORK(B_BEOS_DIRECTORY); + + _BORK(B_USER_BOOT_DIRECTORY); + _BORK(B_USER_FONTS_DIRECTORY); + _BORK(B_USER_LIB_DIRECTORY); + _BORK(B_USER_SETTINGS_DIRECTORY); + _BORK(B_USER_DESKBAR_DIRECTORY); + _BORK(B_USER_PRINTERS_DIRECTORY); + _BORK(B_USER_TRANSLATORS_DIRECTORY); + _BORK(B_USER_MEDIA_NODES_DIRECTORY); + _BORK(B_USER_SOUNDS_DIRECTORY); + // + _BORK(B_USER_ADDONS_DIRECTORY); + _BORK(B_USER_CONFIG_DIRECTORY); + _BORK(B_USER_DIRECTORY); + + // same for the whole block, prefer user over common + _BORK(B_COMMON_BOOT_DIRECTORY); + _BORK(B_COMMON_FONTS_DIRECTORY); + _BORK(B_COMMON_LIB_DIRECTORY); + _BORK(B_COMMON_SERVERS_DIRECTORY); + _BORK(B_COMMON_BIN_DIRECTORY); + _BORK(B_COMMON_ETC_DIRECTORY); + _BORK(B_COMMON_DOCUMENTATION_DIRECTORY); + _BORK(B_COMMON_SETTINGS_DIRECTORY); + _BORK(B_COMMON_DEVELOP_DIRECTORY); + _BORK(B_COMMON_LOG_DIRECTORY); + _BORK(B_COMMON_SPOOL_DIRECTORY); + _BORK(B_COMMON_TEMP_DIRECTORY); + _BORK(B_COMMON_VAR_DIRECTORY); + _BORK(B_COMMON_TRANSLATORS_DIRECTORY); + _BORK(B_COMMON_MEDIA_NODES_DIRECTORY); + _BORK(B_COMMON_SOUNDS_DIRECTORY); + // + _BORK(B_COMMON_ADDONS_DIRECTORY); + _BORK(B_COMMON_SYSTEM_DIRECTORY); + _BORK(B_COMMON_DIRECTORY); + + _BORK(B_APPS_DIRECTORY); + _BORK(B_PREFERENCES_DIRECTORY); + _BORK(B_UTILITIES_DIRECTORY); + + return B_OK; +} +#undef _BORK + +#define _BORK(_t) \ + if (tok == #_t) { \ + err = find_directory(_t, &path); \ + if (err) return err; \ + dir->Remove(s, e - s + 1); \ + dir->Insert(path.Path(), s); \ + return B_OK; \ + } \ + + +status_t unescape_find_directory(BString *dir) +{ + status_t err; + int32 s, e; + BString tok; + BPath path; + s = dir->FindFirst("${"); + if (s < 0) + return B_OK; + e = dir->FindFirst("}", s); + if (e < 0) + return B_OK; + dir->CopyInto(tok, s + 2, e - s - 2); + //printf("tok '%s'\n", tok.String()); + + _BORK(B_DESKTOP_DIRECTORY); + _BORK(B_TRASH_DIRECTORY); + _BORK(B_ROOT_DIRECTORY); + + _BORK(B_BEOS_DIRECTORY); + _BORK(B_BEOS_SYSTEM_DIRECTORY); + _BORK(B_BEOS_ADDONS_DIRECTORY); + _BORK(B_BEOS_BOOT_DIRECTORY); + _BORK(B_BEOS_FONTS_DIRECTORY); + _BORK(B_BEOS_LIB_DIRECTORY); + _BORK(B_BEOS_SERVERS_DIRECTORY); + _BORK(B_BEOS_APPS_DIRECTORY); + _BORK(B_BEOS_BIN_DIRECTORY); + _BORK(B_BEOS_ETC_DIRECTORY); + _BORK(B_BEOS_DOCUMENTATION_DIRECTORY); + _BORK(B_BEOS_PREFERENCES_DIRECTORY); + _BORK(B_BEOS_TRANSLATORS_DIRECTORY); + _BORK(B_BEOS_MEDIA_NODES_DIRECTORY); + _BORK(B_BEOS_SOUNDS_DIRECTORY); + + _BORK(B_COMMON_DIRECTORY); + _BORK(B_COMMON_SYSTEM_DIRECTORY); + _BORK(B_COMMON_ADDONS_DIRECTORY); + _BORK(B_COMMON_BOOT_DIRECTORY); + _BORK(B_COMMON_FONTS_DIRECTORY); + _BORK(B_COMMON_LIB_DIRECTORY); + _BORK(B_COMMON_SERVERS_DIRECTORY); + _BORK(B_COMMON_BIN_DIRECTORY); + _BORK(B_COMMON_ETC_DIRECTORY); + _BORK(B_COMMON_DOCUMENTATION_DIRECTORY); + _BORK(B_COMMON_SETTINGS_DIRECTORY); + _BORK(B_COMMON_DEVELOP_DIRECTORY); + _BORK(B_COMMON_LOG_DIRECTORY); + _BORK(B_COMMON_SPOOL_DIRECTORY); + _BORK(B_COMMON_TEMP_DIRECTORY); + _BORK(B_COMMON_VAR_DIRECTORY); + _BORK(B_COMMON_TRANSLATORS_DIRECTORY); + _BORK(B_COMMON_MEDIA_NODES_DIRECTORY); + _BORK(B_COMMON_SOUNDS_DIRECTORY); + + _BORK(B_USER_DIRECTORY); + _BORK(B_USER_CONFIG_DIRECTORY); + _BORK(B_USER_ADDONS_DIRECTORY); + _BORK(B_USER_BOOT_DIRECTORY); + _BORK(B_USER_FONTS_DIRECTORY); + _BORK(B_USER_LIB_DIRECTORY); + _BORK(B_USER_SETTINGS_DIRECTORY); + _BORK(B_USER_DESKBAR_DIRECTORY); + _BORK(B_USER_PRINTERS_DIRECTORY); + _BORK(B_USER_TRANSLATORS_DIRECTORY); + _BORK(B_USER_MEDIA_NODES_DIRECTORY); + _BORK(B_USER_SOUNDS_DIRECTORY); + + _BORK(B_APPS_DIRECTORY); + _BORK(B_PREFERENCES_DIRECTORY); + _BORK(B_UTILITIES_DIRECTORY); + + return B_OK; +} + +#undef _BORK + +// copy a file including its attributes +#define BUFF_SZ 1024*1024 +status_t copy_file(entry_ref *ref, const char *to) +{ + char *buff; + status_t err = B_OK; + //off_t off; + //size_t got; + (void)ref; (void)to; + + buff = (char *)malloc(BUFF_SZ); + // XXX: TODO + + + free(buff); + return err; +} + + +int testhook() +{ + status_t err; + BString str("/boot/home/config/fonts/ttfonts/toto.ttf"); + err = escape_find_directory(&str); + printf("error 0x%08lx %s\n", err, str.String()); + err = unescape_find_directory(&str); + printf("error 0x%08lx %s\n", err, str.String()); + return 0; + return 1; +} Added: haiku/trunk/3rdparty/themes/FileUtils.h =================================================================== --- haiku/trunk/3rdparty/themes/FileUtils.h 2008-01-11 17:06:27 UTC (rev 23405) +++ haiku/trunk/3rdparty/themes/FileUtils.h 2008-01-11 18:06:15 UTC (rev 23406) @@ -0,0 +1,17 @@ +#ifndef _FILE_UTILS_H +#define _FILE_UTILS_H + +#include +#include + +// find the font file corresponding to family/style +extern status_t find_font_file(entry_ref *to, font_family family, font_style style, float size =-1); + +// replace part of paths by symbolic strings "${B_FOO_DIRECTORY}" +extern status_t escape_find_directory(BString *dir); +extern status_t unescape_find_directory(BString *dir); + +// copy a file including its attributes +extern status_t copy_file(entry_ref *ref, const char *to); + +#endif /* _FILE_UTILS_H */ Added: haiku/trunk/3rdparty/themes/Jamfile =================================================================== --- haiku/trunk/3rdparty/themes/Jamfile 2008-01-11 17:06:27 UTC (rev 23405) +++ haiku/trunk/3rdparty/themes/Jamfile 2008-01-11 18:06:15 UTC (rev 23406) @@ -0,0 +1,40 @@ +SubDir HAIKU_TOP 3rdparty themes ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) 3rdparty themes addons ] ; + +local addonSources ; +addonSources = + BackgroundsAddon.cpp + BeIDEAddon.cpp + DanoWindowDecorAddon.cpp + DeskbarAddon.cpp + EddieAddon.cpp + PeAddon.cpp + ScreensaverAddon.cpp + SoundplayColorAddon.cpp + SoundsAddon.cpp + TerminalAddon.cpp + UISettingsAddon.cpp + WinampSkinAddon.cpp +; + +Application <3rdparty>Themes : + CompareMessages.cpp + DumpMessage.cpp + FileUtils.cpp + MakeScreenshot.cpp + ParseMessage.cpp + ThemeAddonItem.cpp + ThemeInterfaceView.cpp + ThemeItem.cpp + ThemeManager.cpp + ThemePopupTextWindow.cpp + ThemesAddon.cpp + ViewItem.cpp + $(addonSources) + : be media translation $(TARGET_NETAPI_LIB) $(TARGET_LIBSTDC++) + : Themes.rdef +; + Added: haiku/trunk/3rdparty/themes/MakeScreenshot.cpp =================================================================== --- haiku/trunk/3rdparty/themes/MakeScreenshot.cpp 2008-01-11 17:06:27 UTC (rev 23405) +++ haiku/trunk/3rdparty/themes/MakeScreenshot.cpp 2008-01-11 18:06:15 UTC (rev 23406) @@ -0,0 +1,72 @@ +/* + * MakeScreenshot function + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +// PRIVATE: in libzeta for now. +extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap); + +status_t MakeScreenshot(BBitmap **here) +{ + status_t err; + BScreen bs; + BWindow *win; + BBitmap *shot; + BBitmap *scaledBmp = NULL; + be_app->Lock(); + win = be_app->WindowAt(0); + if (win) { + win->Lock(); + win->Hide(); + win->Unlock(); + } + snooze(500000); + err = bs.GetBitmap(&shot); + if (!err) { + BRect scaledBounds(0,0,640-1,480-1); + scaledBmp = new BBitmap(scaledBounds, B_BITMAP_ACCEPTS_VIEWS, B_RGB32/*shot->ColorSpace()*/); + err = scaledBmp->InitCheck(); + if (!err) { + err = ScaleBitmap(*shot, *scaledBmp); + if (err) { + // filtered scaling didn't work, do it manually + BView *v = new BView(scaledBounds, "scaleview", B_FOLLOW_NONE, 0); + scaledBmp->AddChild(v); + v->LockLooper(); + v->DrawBitmap(shot); + v->Sync(); + v->UnlockLooper(); + scaledBmp->RemoveChild(v); + delete v; + err = B_OK; + } + } + delete shot; + } + + if (win) { + win->Lock(); + win->Show(); + win->Unlock(); + } + be_app->Unlock(); + + if (err) + return err; + + *here = scaledBmp; + + return B_OK; +} Added: haiku/trunk/3rdparty/themes/ParseMessage.cpp =================================================================== --- haiku/trunk/3rdparty/themes/ParseMessage.cpp 2008-01-11 17:06:27 UTC (rev 23405) +++ haiku/trunk/3rdparty/themes/ParseMessage.cpp 2008-01-11 18:06:15 UTC (rev 23406) @@ -0,0 +1,465 @@ +#include +#include +#include +#include +#include +#include +#include +#include "DumpMessage.h" + +#define MAX_TEXT_LINE_INPUT_SIZE 4096 + +class TextLineInputDataIO : public BDataIO { +public: + TextLineInputDataIO(BDataIO *input); + ssize_t Read(void *buffer, size_t size); + char GetByte(); + ssize_t Write(const void *data, size_t len); + status_t FillTextLine(); +private: + BDataIO *fIn; + char fTextLine[MAX_TEXT_LINE_INPUT_SIZE]; + char *fCurrent; /* current char in fTextLine */ + int fLeft; +}; + +TextLineInputDataIO::TextLineInputDataIO(BDataIO *input) +{ + fIn = input; + fCurrent = fTextLine; + fLeft = 0; +} + +char TextLineInputDataIO::GetByte() +{ + char buf[2]; + if (Read(buf, 1) == 1) + return buf[0]; + return 0; +} +ssize_t TextLineInputDataIO::Read(void *buffer, size_t size) +{ + size = MIN(size, (size_t)fLeft); + if (size <= 0) + return 0; + fLeft -= size; + memcpy(buffer, fCurrent, size); + fCurrent += size; + return size; +} + +ssize_t TextLineInputDataIO::Write(const void *, size_t) +{ + return EINVAL; +} + +/* + * \return 1 useful line, 0 blank lin or comment, <0 error + */ +status_t TextLineInputDataIO::FillTextLine() +{ + status_t err = ENOENT; + + fCurrent = fTextLine; + while ((fCurrent < (fTextLine + MAX_TEXT_LINE_INPUT_SIZE)) + && ((err = fIn->Read(fCurrent, 1)) > 0) + && *fCurrent != '\n') + fCurrent++; + *fCurrent = '\0'; + fLeft = fCurrent - fTextLine; + fCurrent = fTextLine; +// printf("line: '%s'\n", fCurrent); + + if (err < B_OK) + return err; + if (err == 0) + return -1; // EOF + if (strlen(fCurrent) && strncmp(fCurrent, "//", 2)) + return 1; + return 0; +} + +status_t ParseHexDumpFromStream(const void **, size_t *, BDataIO &) +{ + return B_OK; +} + +status_t Parse_Msg_bool(BMessage *msg, TextLineInputDataIO *st, char *name) +{ + char c; + bool v = false; + c = st->GetByte(); + if (c == '1' || c == 't') + v = true; + msg->AddBool(name, v); + return B_OK; +} + +status_t Parse_Msg_int32(BMessage *msg, TextLineInputDataIO *st, char *name) +{ + char c; + int64 v = 0; // to forget about overflow + bool opposite = false; + while (isdigit(c = st->GetByte()) || c == '-') { + if (c == '-') + opposite = true; + else + v = v * 10 + (c - '0'); + } + if (c == 'x' && v == 0) { + // hex + while (isalnum(c = st->GetByte())) { + v = v * 16; + if (isdigit(c)) + v += (c - '0'); + else if (isupper(c)) + v += (c - 'A' + 10); + else + v += (c - 'a' + 10); + } + } + if (opposite) + v = -v; + msg->AddInt32(name, (int32)v); + return B_OK; +} + +status_t Parse_Msg_float(BMessage *msg, TextLineInputDataIO *st, char *name) +{ + char c; + float v = 0; + int32 div = 1; + bool opposite = false; + while (isdigit(c = st->GetByte()) || c == '-') { + if (c == '-') + opposite = true; + else + v = v * 10 + (c - '0'); + } + if (c == '.') + while (isdigit(c = st->GetByte())) { + div *= 10; + v += (float)(c - '0') / div; + } + if (opposite) + v = -v; + msg->AddFloat(name, v); + return B_OK; +} + +status_t Parse_Msg_string(BMessage *msg, TextLineInputDataIO *st, char *name) +{ + char c; + BString v; + bool esc = false; + if (st->GetByte() != '"') + return EINVAL; + while ((c = st->GetByte()) || esc) { + if (esc && !c) { + v << '\n'; + esc = false; + st->FillTextLine(); + continue; + } + if (esc) { + esc = false; + } else if (c == '\\') { + esc = true; + continue; + } else if (c == '"') + break; + v << c; + } + msg->AddString(name, v.String()); + return B_OK; +} + +status_t Parse_Msg_rgb_color(BMessage *msg, TextLineInputDataIO *st, char *name) +{ + char c; + rgb_color v = {0, 0, 0, 0}; + bool has_alpha = false; + while (isdigit(c = st->GetByte())) + v.red = v.red * 10 + (c - '0'); + while (isdigit(c = st->GetByte())) + v.green = v.green * 10 + (c - '0'); + while (isdigit(c = st->GetByte())) + v.blue = v.blue * 10 + (c - '0'); + while (isdigit(c = st->GetByte())) { + has_alpha = true; + v.alpha = v.alpha * 10 + (c - '0'); + } + if (!has_alpha) + v.alpha = 255; + //msg->AddRGBColor(name, v); + msg->AddData(name, (type_code)'RGBC', &v, 4); + return B_OK; +} + +float Parse_Msg_read_float(TextLineInputDataIO *st) +{ + char c; + int i; + float f = 0.0F; + float scale = 0.1F; + bool isNegative = false; + + i=0; + while ((c = st->GetByte())) + { + if (isdigit(c)) + { + f = f * 10 + c - '0'; + } + else if (c == '-') + { + isNegative = true; + } + else + { + break; + } + } + while (isdigit(c = st->GetByte())) { + f += (c - '0') * scale; + scale /= 10; + } + + if (isNegative) + f *= -1.0; + + return f; +} + +status_t Parse_Msg_BFont(BMessage *msg, TextLineInputDataIO *st, char *name) +{ + char c; + int i; + font_family ff; + font_style fs; + float size = 0.0f; + BFont f; + + i=0; + while ((c = st->GetByte()) != '/') + ff[i++] = c; + ff[i] = '\0'; + i=0; + while ((c = st->GetByte()) != '/') + fs[i++] = c; + fs[i] = '\0'; + + size = Parse_Msg_read_float(st); + +//printf("fam '%s', style '%s'\n", ff, fs); + f.SetFamilyAndStyle(ff, fs); + f.SetSize(size); + //f.PrintToStream(); + msg->AddFlat(name, &f); + return B_OK; [... truncated: 5947 lines follow ...] From mmu_man at mail.berlios.de Fri Jan 11 19:12:40 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 19:12:40 +0100 Subject: [Haiku-commits] r23407 - haiku/trunk/3rdparty Message-ID: <200801111812.m0BICekX013127@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 19:12:39 +0100 (Fri, 11 Jan 2008) New Revision: 23407 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23407&view=rev Added: haiku/trunk/3rdparty/Jamfile Log: A root jamfile for 3rdparty. Added: haiku/trunk/3rdparty/Jamfile =================================================================== --- haiku/trunk/3rdparty/Jamfile 2008-01-11 18:06:15 UTC (rev 23406) +++ haiku/trunk/3rdparty/Jamfile 2008-01-11 18:12:39 UTC (rev 23407) @@ -0,0 +1,3 @@ +SubDir HAIKU_TOP 3rdparty ; + +SubInclude HAIKU_TOP 3rdparty themes ; From mmu_man at mail.berlios.de Fri Jan 11 19:14:52 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 19:14:52 +0100 Subject: [Haiku-commits] r23408 - haiku/trunk Message-ID: <200801111814.m0BIEqJi017248@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 19:14:51 +0100 (Fri, 11 Jan 2008) New Revision: 23408 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23408&view=rev Modified: haiku/trunk/Jamfile Log: Hook in 3rdparty/ to the main build. Currently it's optional, you must define HAIKU_INCLUDE_3RDPARTY in [User]BuildConfig. Modified: haiku/trunk/Jamfile =================================================================== --- haiku/trunk/Jamfile 2008-01-11 18:12:39 UTC (rev 23407) +++ haiku/trunk/Jamfile 2008-01-11 18:14:51 UTC (rev 23408) @@ -141,6 +141,9 @@ } else { SubInclude HAIKU_TOP src ; } +if $(HAIKU_INCLUDE_3RDPARTY) { + SubInclude HAIKU_TOP 3rdparty ; +} # reset subdir SubDir HAIKU_TOP ; From stippi at mail.berlios.de Fri Jan 11 19:14:52 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 11 Jan 2008 19:14:52 +0100 Subject: [Haiku-commits] r23409 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200801111814.m0BIEqJf017249@sheep.berlios.de> Author: stippi Date: 2008-01-11 19:14:51 +0100 (Fri, 11 Jan 2008) New Revision: 23409 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23409&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.h Log: * renamed remove_device() to delete_device() * handle one more allocation failure in device_added * improved style consistency in a few places Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-11 18:14:51 UTC (rev 23408) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-11 18:14:51 UTC (rev 23409) @@ -281,6 +281,9 @@ static const char *sMouseBaseName = "input/mouse/usb/"; +// #pragma mark - support functions + + hid_device_info * create_device(const usb_device *dev, const usb_interface_info *ii, uint16 ifno, bool isKeyboard) @@ -364,7 +367,7 @@ void -remove_device(hid_device_info *device) +delete_device(hid_device_info *device) { assert(device != NULL); @@ -501,7 +504,7 @@ USB_REQUEST_HID_SET_REPORT, 0x200 | report_id, device->ifno, actual, &leds, actual, &actual); - DPRINTF_INFO ((MY_ID "set_leds: leds=0x%02x, status=%d, len=%d\n", + DPRINTF_INFO((MY_ID "set_leds: leds=0x%02x, status=%d, len=%d\n", leds, (int) status, (int)actual)); } @@ -575,7 +578,7 @@ /*! - callback: got a report, issue next request + callback: got a report, unblock input server thread in hid_device_control() */ static void usb_callback(void *cookie, status_t busStatus, @@ -592,6 +595,7 @@ release_sem_etc(device->sem_cb, 1, B_DO_NOT_RESCHEDULE); } + static status_t schedule_interrupt_transfer(hid_device_info* device) { @@ -599,11 +603,12 @@ device->total_report_size, usb_callback, device); if (status != B_OK) { /* XXX probably endpoint stall */ - DPRINTF_ERR ((MY_ID "queue_interrupt() error %d\n", (int)status)); + DPRINTF_ERR((MY_ID "queue_interrupt() error %d\n", (int)status)); } return status; } + static status_t handle_interrupt_transfer(hid_device_info* device) { @@ -614,6 +619,7 @@ DPRINTF_ERR((MY_ID "bus status %d\n", (int)device->bus_status)); if (status == B_CANCELED) { /* cancelled: device is unplugged */ + device->active = false; return status; } @@ -637,7 +643,7 @@ for (i = 0; i < device->total_report_size; i++) sprintf (&linbuf[i*3], "%02X ", buffer [i]); - DPRINTF_INFO ((MY_ID "input report: %s\n", linbuf)); + DPRINTF_INFO((MY_ID "input report: %s\n", linbuf)); #endif device->timestamp = system_time(); @@ -672,11 +678,11 @@ bool is_keyboard; assert(dev != NULL && cookie != NULL); - DPRINTF_INFO ((MY_ID "device_added()\n")); + DPRINTF_INFO((MY_ID "device_added()\n")); dev_desc = usb->get_device_descriptor(dev); - DPRINTF_INFO ((MY_ID "vendor ID 0x%04X, product ID 0x%04X\n", + DPRINTF_INFO((MY_ID "vendor ID 0x%04X, product ID 0x%04X\n", dev_desc->vendor_id, dev_desc->product_id)); if (dev_desc->vendor_id == USB_VENDOR_WACOM) @@ -685,7 +691,7 @@ /* check interface class */ if ((conf = usb->get_nth_configuration(dev, DEFAULT_CONFIGURATION)) == NULL) { - DPRINTF_ERR ((MY_ID "cannot get default configuration\n")); + DPRINTF_ERR((MY_ID "cannot get default configuration\n")); return B_ERROR; } @@ -693,11 +699,11 @@ /* This is C; I can use "class" :-> */ int class, subclass, protocol; - intf = conf->interface [ifno].active; + intf = conf->interface[ifno].active; class = intf->descr->interface_class; subclass = intf->descr->interface_subclass; protocol = intf->descr->interface_protocol; - DPRINTF_INFO ((MY_ID "interface %d: class %d, subclass %d, protocol %d\n", + DPRINTF_INFO((MY_ID "interface %d: class %d, subclass %d, protocol %d\n", ifno, class, subclass, protocol)); if (class == USB_HID_DEVICE_CLASS && subclass == USB_HID_INTERFACE_BOOT_SUBCLASS) @@ -705,21 +711,24 @@ } if (ifno >= conf->interface_count) { - DPRINTF_INFO ((MY_ID "Boot HID interface not found\n")); + DPRINTF_INFO((MY_ID "Boot HID interface not found\n")); return B_ERROR; } /* read HID descriptor */ - desc_len = sizeof (usb_hid_descriptor); - hid_desc = malloc (desc_len); + desc_len = sizeof(usb_hid_descriptor); + hid_desc = malloc(desc_len); + if (hid_desc == NULL) + return B_NO_MEMORY; + status = usb->send_request(dev, USB_REQTYPE_INTERFACE_IN | USB_REQTYPE_STANDARD, USB_REQUEST_GET_DESCRIPTOR, USB_HID_DESCRIPTOR_HID << 8, ifno, desc_len, hid_desc, desc_len, &desc_len); - DPRINTF_INFO ((MY_ID "get_hid_desc: status=%d, len=%d\n", - (int) status, (int)desc_len)); + DPRINTF_INFO((MY_ID "get_hid_desc: status=%d, len=%d\n", + (int)status, (int)desc_len)); if (status != B_OK) desc_len = 256; /* XXX */ @@ -779,9 +788,9 @@ /* decompose report descriptor */ num_items = desc_len; /* XXX */ - items = malloc(sizeof (decomp_item) * num_items); + items = malloc(sizeof(decomp_item) * num_items); if (items == NULL) { - remove_device(device); + delete_device(device); free(rep_desc); return B_NO_MEMORY; } @@ -792,32 +801,32 @@ /* parse report descriptor */ device->num_insns = num_items; /* XXX */ - device->insns = malloc (sizeof (report_insn) * device->num_insns); + device->insns = malloc(sizeof (report_insn) * device->num_insns); if (device->insns == NULL) { - remove_device(device); + delete_device(device); free(items); return B_NO_MEMORY; } - parse_report_descriptor (items, num_items, device->insns, + parse_report_descriptor(items, num_items, device->insns, &device->num_insns, &device->total_report_size, &report_id); free(items); device->insns = realloc(device->insns, sizeof (report_insn) * device->num_insns); if (device->insns == NULL) { - remove_device(device); + delete_device(device); return B_NO_MEMORY; } - DPRINTF_INFO ((MY_ID "%d items, %d insns, %d bytes\n", + DPRINTF_INFO((MY_ID "%d items, %d insns, %d bytes\n", (int)num_items, (int)device->num_insns, (int)device->total_report_size)); /* count axes, hats and buttons */ /*count_controls (device->insns, device->num_insns, &device->num_axes, &device->num_hats, &device->num_buttons); - DPRINTF_INFO ((MY_ID "%d axes, %d hats, %d buttons\n", + DPRINTF_INFO((MY_ID "%d axes, %d hats, %d buttons\n", device->num_axes, device->num_hats, device->num_buttons));*/ /* get initial state */ @@ -830,11 +839,11 @@ 0x0100 | report_id, ifno, device->total_report_size, device->buffer, device->total_report_size, &actual); if (status != B_OK) - DPRINTF_ERR ((MY_ID "Get_Report failed %d\n", (int)status)); + DPRINTF_ERR((MY_ID "Get_Report failed %d\n", (int)status)); #endif device->timestamp = system_time (); - DPRINTF_INFO ((MY_ID "%08lx %08lx %08lx\n", *(((uint32*)device->buffer)), *(((uint32*)device->buffer)+1), *(((uint32*)device->buffer)+2))); + DPRINTF_INFO((MY_ID "%08lx %08lx %08lx\n", *(((uint32*)device->buffer)), *(((uint32*)device->buffer)+1), *(((uint32*)device->buffer)+2))); device->ept = &intf->endpoint[0]; /* interrupt IN */ @@ -843,7 +852,7 @@ add_device_info(device); *cookie = device; - DPRINTF_INFO ((MY_ID "added %s\n", device->name)); + DPRINTF_INFO((MY_ID "added %s\n", device->name)); return B_OK; } @@ -853,17 +862,17 @@ { hid_device_info *device = cookie; - assert (cookie != NULL); + assert(cookie != NULL); DPRINTF_INFO((MY_ID "device_removed(%s)\n", device->name)); - usb->cancel_queued_transfers (device->ept->handle); + usb->cancel_queued_transfers(device->ept->handle); remove_device_info(device); if (device->open == 0) { if (device->insns != NULL) free(device->insns); - remove_device(device); + delete_device(device); } else { DPRINTF_INFO((MY_ID "%s still open\n", device->name)); device->active = false; @@ -882,7 +891,7 @@ assert (name != NULL); assert (out_cookie != NULL); - DPRINTF_INFO ((MY_ID "open(%s)\n", name)); + DPRINTF_INFO((MY_ID "open(%s)\n", name)); if ((device = search_device_info (name)) == NULL) return B_ENTRY_NOT_FOUND; @@ -897,7 +906,7 @@ release_sem(device->sem_lock); *out_cookie = cookie; - DPRINTF_INFO ((MY_ID "device %s open (%d)\n", name, device->open)); + DPRINTF_INFO((MY_ID "device %s open (%d)\n", name, device->open)); return B_OK; } @@ -927,7 +936,7 @@ assert (cookie != NULL); device = cookie->device; assert (device != NULL); - DPRINTF_INFO ((MY_ID "ioctl(0x%x)\n", (int)op)); + DPRINTF_INFO((MY_ID "ioctl(0x%x)\n", (int)op)); if (!device->active) return B_ERROR; /* already unplugged */ @@ -1030,7 +1039,7 @@ assert (cookie != NULL && cookie->device != NULL); device = cookie->device; - DPRINTF_INFO ((MY_ID "close(%s)\n", device->name)); + DPRINTF_INFO((MY_ID "close(%s)\n", device->name)); /* detach the cookie from list */ @@ -1068,8 +1077,8 @@ else if (!device->active) { DPRINTF_INFO((MY_ID "removed %s\n", device->name)); if (device->insns != NULL) - free (device->insns); - remove_device (device); + free(device->insns); + delete_device(device); } return B_OK; Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.h 2008-01-11 18:14:51 UTC (rev 23408) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.h 2008-01-11 18:14:51 UTC (rev 23409) @@ -98,14 +98,14 @@ /* hid.c */ -extern usb_module_info *usb; -extern const char *my_driver_name; -extern const char *keyboard_base_name; -extern const char *mouse_base_name; +extern usb_module_info* usb; +extern const char* my_driver_name; +extern const char* keyboard_base_name; +extern const char* mouse_base_name; -hid_device_info *create_device(const usb_device *dev, const usb_interface_info *ii, - uint16 ifno, bool is_keyboard); -void remove_device(hid_device_info *device); +hid_device_info* create_device(const usb_device *dev, + const usb_interface_info *ii, uint16 ifno, bool is_keyboard); +void delete_device(hid_device_info *device); /* devlist.c */ From mmu_man at mail.berlios.de Fri Jan 11 19:15:55 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 19:15:55 +0100 Subject: [Haiku-commits] r23410 - haiku/trunk Message-ID: <200801111815.m0BIFtA7018902@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 19:15:55 +0100 (Fri, 11 Jan 2008) New Revision: 23410 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23410&view=rev Modified: haiku/trunk/configure Log: Add --enable-multiuser configure option for adventurous people. Modified: haiku/trunk/configure =================================================================== --- haiku/trunk/configure 2008-01-11 18:14:51 UTC (rev 23409) +++ haiku/trunk/configure 2008-01-11 18:15:55 UTC (rev 23410) @@ -43,6 +43,7 @@ default -- any other distro (default value). --help Prints out this help. --include-gpl-addons Include GPL licensed add-ons. + --enable-multiuser Enable experimental multiuser support. --target=TARGET Select build target platform. [default=${target}] valid targets=r5,bone,dano,haiku --use-gcc-pipe Build with GCC option -pipe. Speeds up the build @@ -218,6 +219,7 @@ hostGCCVersion=`gcc -dumpversion` bochs_debug=0 include_gpl_addons=0 +enable_multiuser=0 distroCompatibility=default target=haiku use_gcc_pipe=0 @@ -263,6 +265,7 @@ --cross-tools-prefix) assertparam "$1" $#; crossToolsPrefix=$2; shift 2;; --help | -h) usage; exit 0;; --include-gpl-addons) include_gpl_addons=1; shift 1;; + --enable-multiuser) enable_multiuser=1; shift 1;; --distro-compatibility) assertparam "$1" $#; distroCompatibility=$2; case "$distroCompatibility" in @@ -352,6 +355,7 @@ BOCHS_DEBUG_HACK ?= "${bochs_debug}" ; INCLUDE_GPL_ADDONS ?= "${include_gpl_addons}" ; +HAIKU_ENABLE_MULTIUSER ?= "${enable_multiuser}" ; HAIKU_DISTRO_COMPATIBILITY ?= "${distroCompatibility}" ; HAIKU_USE_GCC_PIPE ?= "${use_gcc_pipe}" ; HAIKU_HOST_USE_32BIT ?= "${use_32bit}" ; From marcusoverhagen at mail.berlios.de Fri Jan 11 19:49:13 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Fri, 11 Jan 2008 19:49:13 +0100 Subject: [Haiku-commits] r23411 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801111849.m0BInDGE012763@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-11 19:49:12 +0100 (Fri, 11 Jan 2008) New Revision: 23411 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23411&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c Log: Converted check_output() into ata_finish_request(). Moved timeout from device_info int ata_request-. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-11 18:15:55 UTC (rev 23410) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-11 18:49:12 UTC (rev 23411) @@ -151,7 +151,7 @@ return ata_wait(bus, 0, ide_status_bsy | ide_status_drq, 0, 20000); } - +/* // busy wait for device beeing ready, // using the timeout set by the previous ata_send_command status_t @@ -160,8 +160,8 @@ ASSERT(device->bus->state == ata_state_pio); return ata_wait(device->bus, ide_status_drdy, ide_status_bsy, 0, device->pio_timeout); } +*/ - status_t ata_send_command(ide_device_info *device, ata_request *request, ata_flags flags, bigtime_t timeout) { @@ -191,13 +191,13 @@ if (ata_wait_idle(bus) != B_OK) { // resetting the device here will discard current configuration, // it's better when the SCSI bus manager requests an external reset. - TRACE("device selection timeout\n"); + TRACE("ata_send_command: device selection timeout\n"); ata_request_set_status(request, SCSI_SEL_TIMEOUT); - return B_ERROR; + return B_ERROR; } if ((flags & ATA_DRDY_REQUIRED) && (bus->controller->get_altstatus(bus->channel_cookie) & ide_status_drdy) == 0) { - TRACE("drdy not set\n"); + TRACE("ata_send_command: drdy not set\n"); ata_request_set_status(request, SCSI_SEQUENCE_FAIL); return B_ERROR; } @@ -223,15 +223,13 @@ ASSERT(bus->state == ata_state_busy); bus->state = (flags & ATA_DMA_TRANSFER) ? ata_state_dma : ata_state_pio; - if (request) - request->device->pio_timeout = timeout; + request->timeout = timeout; IDE_UNLOCK(bus); return B_OK; - err_clearint: bus->controller->write_device_control(bus->channel_cookie, ide_devctrl_bit3 | ide_devctrl_nien); @@ -251,93 +249,104 @@ status_t ata_finish_command(ide_device_info *device, ata_request *request, ata_flags flags, uint8 errorMask) { -#if 0 ide_bus_info *bus = device->bus; - uint8 status; + status_t result; + uint8 error; - // check IRQ timeout - if (bus->sync_wait_timeout) { - bus->sync_wait_timeout = false; - - device->subsys_status = SCSI_CMD_TIMEOUT; - return false; + if (flags & ATA_WAIT_FINISH) { + // wait for the command to finish current command (device no longer busy) + result = ata_wait(bus, 0, ide_status_bsy, 0, request->timeout); + if (result != B_OK) { + TRACE("ata_finish_command: timeout\n"); + ata_request_set_status(request, SCSI_CMD_TIMEOUT); + return result; + } } - status = bus->controller->get_altstatus(bus->channel_cookie); - - // if device is busy, other flags are indeterminate - if ((status & ide_status_bsy) != 0) { - device->subsys_status = SCSI_SEQUENCE_FAIL; - return false; + // read status, this also acknowledges pending interrupts + result = device->bus->controller->read_command_block_regs(device->bus->channel_cookie, &device->tf, ide_mask_status | ide_mask_error); + if (result != B_OK) { + TRACE("ata_finish_command: status register read failed\n"); + ata_request_set_status(request, SCSI_SEQUENCE_FAIL); + return result; } - - if (drdy_required && ((status & ide_status_drdy) == 0)) { - device->subsys_status = SCSI_SEQUENCE_FAIL; - return false; + + if (device->tf.read.status & ide_status_bsy) { + TRACE("ata_finish_command: failed! device still busy\n"); + ata_request_set_status(request, SCSI_SEQUENCE_FAIL); + return B_ERROR; } + + if ((flags & ATA_DRDY_REQUIRED) && (device->tf.read.status & ide_status_drdy) == 0) { + TRACE("ata_finish_command: failed! drdy not set\n"); + ata_request_set_status(request, SCSI_SEQUENCE_FAIL); + return B_ERROR; + } - if ((status & ide_status_err) != 0) { - uint8 error; + if ((device->tf.read.status & ide_status_err) == 0) + return B_OK; - if (bus->controller->read_command_block_regs(bus->channel_cookie, - &device->tf, ide_mask_error) != B_OK) { - device->subsys_status = SCSI_HBA_ERR; - return false; - } + result = device->bus->controller->read_command_block_regs(device->bus->channel_cookie, &device->tf, ide_mask_error); + if (result != B_OK) { + TRACE("ata_finish_command: error register read failed\n"); + ata_request_set_status(request, SCSI_SEQUENCE_FAIL); + return result; + } - error = device->tf.read.error & error_mask; + TRACE("ata_finish_command: command failed ERR bit is set\n"); - if ((error & ide_error_icrc) != 0) { - set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_LUN_COM_CRC); - return false; - } + // check only relevant error bits + error = device->tf.read.error & errorMask; + result = B_ERROR; - if (is_write) { - if ((error & ide_error_wp) != 0) { - set_sense(device, SCSIS_KEY_DATA_PROTECT, SCSIS_ASC_WRITE_PROTECTED); - return false; - } - } else { - if ((error & ide_error_unc) != 0) { - set_sense(device, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_UNREC_READ_ERR); - return false; - } - } + if (error & ide_error_icrc) { + ata_request_set_sense(request, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_LUN_COM_CRC); + return B_ERROR; + } - if ((error & ide_error_mc) != 0) { - // XXX proper sense key? - set_sense(device, SCSIS_KEY_UNIT_ATTENTION, SCSIS_ASC_MEDIUM_CHANGED); - return false; + if (flags & ATA_IS_WRITE) { + if (error & ide_error_wp) { + ata_request_set_sense(request, SCSIS_KEY_DATA_PROTECT, SCSIS_ASC_WRITE_PROTECTED); + return B_ERROR; } - - if ((error & ide_error_idnf) != 0) { - // XXX strange error code, don't really know what it means - set_sense(device, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_RANDOM_POS_ERROR); - return false; + } else { + if (error & ide_error_unc) { + ata_request_set_sense(request, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_UNREC_READ_ERR); + return B_ERROR; } + } - if ((error & ide_error_mcr) != 0) { - // XXX proper sense key? - set_sense(device, SCSIS_KEY_UNIT_ATTENTION, SCSIS_ASC_REMOVAL_REQUESTED); - return false; - } + if (error & ide_error_mc) { + // XXX proper sense key? + ata_request_set_sense(request, SCSIS_KEY_UNIT_ATTENTION, SCSIS_ASC_MEDIUM_CHANGED); + return B_ERROR; + } - if ((error & ide_error_nm) != 0) { - set_sense(device, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_NO_MEDIUM); - return false; - } + if (error & ide_error_idnf) { + // XXX strange error code, don't really know what it means + ata_request_set_sense(request, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_RANDOM_POS_ERROR); + return B_ERROR; + } - if ((error & ide_error_abrt) != 0) { - set_sense(device, SCSIS_KEY_ABORTED_COMMAND, SCSIS_ASC_NO_SENSE); - return false; - } + if (error & ide_error_mcr) { + // XXX proper sense key? + ata_request_set_sense(request, SCSIS_KEY_UNIT_ATTENTION, SCSIS_ASC_REMOVAL_REQUESTED); + return B_ERROR; + } - // either there was no error bit set or it was masked out - set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_INTERNAL_FAILURE); - return false; + if (error & ide_error_nm) { + ata_request_set_sense(request, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_NO_MEDIUM); + return B_ERROR; } -#endif - return B_OK; + + if (error & ide_error_abrt) { + ata_request_set_sense(request, SCSIS_KEY_ABORTED_COMMAND, SCSIS_ASC_NO_SENSE); + return B_ERROR; + } + + // either there was no error bit set or it was masked out + ata_request_set_sense(request, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_INTERNAL_FAILURE); + return B_ERROR; } @@ -818,7 +827,6 @@ // finish_reset_queue(request); ata_request_finish(request, false); - } @@ -899,106 +907,6 @@ } -/** check result of ATA command - * drdy_required - true if drdy must be set by device - * error_mask - bits to be checked in error register - * is_write - true, if command was a write command - */ - -bool -check_output(ide_device_info *device, bool drdy_required, - int error_mask, bool is_write) -{ -#if 0 - ide_bus_info *bus = device->bus; - uint8 status; - - // check IRQ timeout - if (bus->sync_wait_timeout) { - bus->sync_wait_timeout = false; - - device->subsys_status = SCSI_CMD_TIMEOUT; - return false; - } - - status = bus->controller->get_altstatus(bus->channel_cookie); - - // if device is busy, other flags are indeterminate - if ((status & ide_status_bsy) != 0) { - device->subsys_status = SCSI_SEQUENCE_FAIL; - return false; - } - - if (drdy_required && ((status & ide_status_drdy) == 0)) { - device->subsys_status = SCSI_SEQUENCE_FAIL; - return false; - } - - if ((status & ide_status_err) != 0) { - uint8 error; - - if (bus->controller->read_command_block_regs(bus->channel_cookie, - &device->tf, ide_mask_error) != B_OK) { - device->subsys_status = SCSI_HBA_ERR; - return false; - } - - error = device->tf.read.error & error_mask; - - if ((error & ide_error_icrc) != 0) { - set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_LUN_COM_CRC); - return false; - } - - if (is_write) { - if ((error & ide_error_wp) != 0) { - set_sense(device, SCSIS_KEY_DATA_PROTECT, SCSIS_ASC_WRITE_PROTECTED); - return false; - } - } else { - if ((error & ide_error_unc) != 0) { - set_sense(device, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_UNREC_READ_ERR); - return false; - } - } - - if ((error & ide_error_mc) != 0) { - // XXX proper sense key? - set_sense(device, SCSIS_KEY_UNIT_ATTENTION, SCSIS_ASC_MEDIUM_CHANGED); - return false; - } - - if ((error & ide_error_idnf) != 0) { - // XXX strange error code, don't really know what it means - set_sense(device, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_RANDOM_POS_ERROR); - return false; - } - - if ((error & ide_error_mcr) != 0) { - // XXX proper sense key? - set_sense(device, SCSIS_KEY_UNIT_ATTENTION, SCSIS_ASC_REMOVAL_REQUESTED); - return false; - } - - if ((error & ide_error_nm) != 0) { - set_sense(device, SCSIS_KEY_MEDIUM_ERROR, SCSIS_ASC_NO_MEDIUM); - return false; - } - - if ((error & ide_error_abrt) != 0) { - set_sense(device, SCSIS_KEY_ABORTED_COMMAND, SCSIS_ASC_NO_SENSE); - return false; - } - - // either there was no error bit set or it was masked out - set_sense(device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_INTERNAL_FAILURE); - return false; - } -#endif - return true; -} - - /** execute SET FEATURE command * set subcommand in task file before calling this */ @@ -1006,19 +914,22 @@ static bool device_set_feature(ide_device_info *device, int feature) { -#if 0 + ata_request request; + ata_request_init(&request, device); + + TRACE("device_set_feature: feature %d\n", feature); + device->tf_param_mask = ide_mask_features; device->tf.write.features = feature; device->tf.write.command = IDE_CMD_SET_FEATURES; - if (!send_command(device, NULL, ATA_DRDY_REQUIRED, 1000000)) + if (ata_send_command(device, &request, ATA_DRDY_REQUIRED, 1000000) != B_OK) return false; - wait_for_sync(device->bus); + if (ata_finish_command(device, &request, ATA_WAIT_FINISH | ATA_DRDY_REQUIRED, ide_error_abrt) != B_OK) + return false; - return check_output(device, true, ide_error_abrt, false); -#endif return true; } @@ -1026,8 +937,8 @@ static bool configure_rmsn(ide_device_info *device) { -#if 0 ide_bus_info *bus = device->bus; + ata_request request; int i; if (!device->infoblock.RMSN_supported @@ -1040,27 +951,27 @@ bus->controller->read_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_LBA_mid | ide_mask_LBA_high); + ata_request_init(&request, device); + for (i = 0; i < 5; ++i) { // don't use TUR as it checks not ide_error_mcr | ide_error_mc | ide_error_wp // but: we don't check wp as well - device->combined_sense = 0; device->tf_param_mask = 0; device->tf.write.command = IDE_CMD_GET_MEDIA_STATUS; - if (!send_command(device, NULL, ATA_DRDY_REQUIRED, 15000000)) + if (!ata_send_command(device, &request, ATA_DRDY_REQUIRED, 15000000)) continue; - if (check_output(device, true, - ide_error_nm | ide_error_abrt | ide_error_mcr | ide_error_mc, - true) - || decode_sense_asc_ascq(device->combined_sense) == SCSIS_ASC_NO_MEDIUM) + if (ata_finish_command(device, &request, ATA_WAIT_FINISH | ATA_DRDY_REQUIRED, + ide_error_nm | ide_error_abrt | ide_error_mcr | ide_error_mc) == B_OK + || ((request.senseAsc << 8) | request.senseAscq) == SCSIS_ASC_NO_MEDIUM) return true; + + ata_request_clear_sense(&request); } return false; -#endif - return true; } @@ -1151,23 +1062,26 @@ status_t ata_identify_device(ide_device_info *device, bool isAtapi) { + ata_request request; ide_bus_info *bus = device->bus; TRACE("ata_identify_device: bus %p, device %d, isAtapi %d\n", device->bus, device->is_device1, isAtapi); + ata_request_init(&request, device); + ata_select(device); device->tf_param_mask = 0; device->tf.write.command = isAtapi ? IDE_CMD_IDENTIFY_PACKET_DEVICE : IDE_CMD_IDENTIFY_DEVICE; - if (ata_send_command(device, NULL, isAtapi ? 0 : ATA_DRDY_REQUIRED, 20000000) != B_OK) { + if (ata_send_command(device, &request, isAtapi ? 0 : ATA_DRDY_REQUIRED, 20000000) != B_OK) { TRACE("ata_identify_device: send_command failed\n"); - goto error; + return B_ERROR; } if (ata_wait(bus, ide_status_drq, ide_status_bsy, ATA_CHECK_ERROR_BIT, 4000000) != B_OK) { TRACE("ata_identify_device: wait failed\n"); - goto error; + return B_ERROR; } // get the infoblock @@ -1176,29 +1090,12 @@ if (ata_wait_for_drqdown(bus) != B_OK) { TRACE("ata_identify_device: ata_wait_for_drqdown failed\n"); - goto error; + return B_ERROR; } - // clear pending interrupt - ata_read_status(device, NULL); + if (ata_finish_command(device, &request, ATA_WAIT_FINISH | ATA_DRDY_REQUIRED, ide_error_abrt) != B_OK) + return B_ERROR; - // XXX fix me - IDE_LOCK(bus); - bus->state = ata_state_busy; - IDE_UNLOCK(bus); - TRACE("ata_identify_device: success\n"); return B_OK; - -error: - - // clear pending interrupt - ata_read_status(device, NULL); - - - // XXX fix me - IDE_LOCK(bus); - bus->state = ata_state_busy; - IDE_UNLOCK(bus); - return B_ERROR; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-11 18:15:55 UTC (rev 23410) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-11 18:49:12 UTC (rev 23411) @@ -46,9 +46,12 @@ ASSERT(request->device == device); request->ccb = ccb; +/* + already set request->is_write = 0; request->uses_dma = 0; request->packet_irq = 0; +*/ // XXX the following always triggers. Why? // ASSERT(request->ccb->subsys_status == SCSI_REQ_INPROG); @@ -75,17 +78,14 @@ ata_request_set_status(ata_request *request, uint8 status) { ASSERT(status != SCSI_REQ_CMP); - if (!request) - return; - request->ccb->subsys_status = status; + if (request->ccb) + request->ccb->subsys_status = status; } void ata_request_set_sense(ata_request *request, uint8 key, uint16 asc_acq) { - if (!request) - return; request->senseKey = key; request->senseAsc = asc_acq >> 8; request->senseAscq = asc_acq & 0xff; @@ -95,15 +95,17 @@ void ata_request_finish(ata_request *request, bool resubmit) { - scsi_ccb *ccb; + scsi_ccb *ccb = request->ccb; + ASSERT(ccb); + TRACE("ata_request_finish: request %p, subsys_status 0x%02x, senseKey %02x\n", - request, request->ccb->subsys_status, request->senseKey); + request, ccb->subsys_status, request->senseKey); // when the request completed and has set sense // data, report this to the scsci stack by setting // CHECK CONDITION status - if (request->ccb->subsys_status == SCSI_REQ_CMP && request->senseKey != 0) { + if (ccb->subsys_status == SCSI_REQ_CMP && request->senseKey != 0) { TRACE("ata_request_finish - setting check condition\n"); @@ -136,8 +138,6 @@ } } - ccb = request->ccb; - IDE_LOCK(request->device->bus); ASSERT(request->device->bus->state == ata_state_busy); ASSERT(request->device->bus->active_device == request->device); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.h 2008-01-11 18:15:55 UTC (rev 23410) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.h 2008-01-11 18:49:12 UTC (rev 23411) @@ -18,6 +18,8 @@ uint8 senseKey; uint8 senseAsc; uint8 senseAscq; + + bigtime_t timeout; } ata_request; struct scsi_ccb; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-11 18:15:55 UTC (rev 23410) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-11 18:49:12 UTC (rev 23411) @@ -104,7 +104,6 @@ uint8 device_type; // atapi device type // pio from here on - bigtime_t pio_timeout; int left_sg_elem; // remaining sg elements const physical_entry *cur_sg_elem; // active sg element int cur_sg_ofs; // offset in active sg element @@ -132,7 +131,8 @@ ATA_IS_WRITE = 0x02, // ATA_PIO_TRANSFER = 0x04, ATA_DMA_TRANSFER = 0x08, - ATA_CHECK_ERROR_BIT = 0x10 + ATA_CHECK_ERROR_BIT = 0x10, + ATA_WAIT_FINISH = 0x20 } ata_flags; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-11 18:15:55 UTC (rev 23410) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-11 18:49:12 UTC (rev 23411) @@ -194,7 +194,7 @@ // XXX fix me IDE_LOCK(bus); - ASSERT(bus->state == ata_state_busy); + ASSERT(bus->state != ata_state_idle); bus->state = ata_state_idle; IDE_UNLOCK(bus); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-11 18:15:55 UTC (rev 23410) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-11 18:49:12 UTC (rev 23411) @@ -230,21 +230,18 @@ device->tf_param_mask = 0; device->tf.write.command = IDE_CMD_GET_MEDIA_STATUS; - if (ata_send_command(device, request, ATA_DRDY_REQUIRED, 15) != B_OK) { + if (ata_send_command(device, request, ATA_DRDY_REQUIRED, 15000000) != B_OK) { + ata_request_set_status(request, SCSI_SEQUENCE_FAIL); return; } - // bits ide_error_mcr | ide_error_mc | ide_error_wp are also valid // but not requested by TUR; ide_error_wp can safely be ignored, but // we don't want to loose media change (request) reports - if (!check_output(device, true, - ide_error_nm | ide_error_abrt | ide_error_mcr | ide_error_mc, - false)) { + ata_finish_command(device, request, ATA_WAIT_FINISH | ATA_DRDY_REQUIRED, + ide_error_nm | ide_error_abrt | ide_error_mcr | ide_error_mc); // SCSI spec is unclear here: we shouldn't report "media change (request)" // but what to do if there is one? anyway - we report them - ; - } } @@ -252,7 +249,6 @@ static bool scsi_synchronize_cache(ide_device_info *device, ata_request *request) { -#if 0 // we should also ask for FLUSH CACHE support, but everyone denies it // (looks like they cheat to gain some performance advantage, but // that's pretty useless: everyone does it...) @@ -264,14 +260,13 @@ : IDE_CMD_FLUSH_CACHE; // spec says that this may take more then 30s, how much more? - if (!send_command(device, request, true, 60, ide_state_sync_waiting)) + if (ata_send_command(device, request, ATA_DRDY_REQUIRED, 60000000) != B_OK) return false; - wait_for_sync(device->bus); + if (ata_finish_command(device, request, ATA_WAIT_FINISH | ATA_DRDY_REQUIRED, ide_error_abrt) != B_OK) + return false; - return check_output(device, true, ide_error_abrt, false); -#endif - return false; + return true; } @@ -281,24 +276,22 @@ static bool scsi_load_eject(ide_device_info *device, ata_request *request, bool load) { -#if 0 if (load) { // ATA doesn't support loading - set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_PARAM_NOT_SUPPORTED); + ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_PARAM_NOT_SUPPORTED); return false; } device->tf_param_mask = 0; device->tf.lba.command = IDE_CMD_MEDIA_EJECT; - if (!send_command(device, request, true, 15, ide_state_sync_waiting)) + if (ata_send_command(device, request, ATA_DRDY_REQUIRED, 15000000) != B_OK) return false; - wait_for_sync(device->bus); + if (ata_finish_command(device, request, ATA_WAIT_FINISH | ATA_DRDY_REQUIRED, ide_error_abrt | ide_error_nm) != B_OK) + return false; - return check_output(device, true, ide_error_abrt | ide_error_nm, false); -#endif - return false; + return true; } From mmlr at mail.berlios.de Fri Jan 11 19:53:40 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 11 Jan 2008 19:53:40 +0100 Subject: [Haiku-commits] r23412 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200801111853.m0BIrec6013255@sheep.berlios.de> Author: mmlr Date: 2008-01-11 19:53:39 +0100 (Fri, 11 Jan 2008) New Revision: 23412 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23412&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/Jamfile haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c Log: * Add handling for B_INTERRUPTED so USB keyboards can work again * Beginnings of devfs interaction to properly publish/unpublish under Haiku Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/Jamfile 2008-01-11 18:49:12 UTC (rev 23411) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/Jamfile 2008-01-11 18:53:39 UTC (rev 23412) @@ -4,6 +4,7 @@ SubDirSysHdrs $(HAIKU_TOP) headers os drivers ; UsePrivateHeaders [ FDirName kernel util ] input ; +UsePrivateHeaders kernel ; local buffer_impl = ; if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-11 18:49:12 UTC (rev 23411) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-11 18:53:39 UTC (rev 23412) @@ -21,6 +21,9 @@ #include #include +#ifdef HAIKU_TARGET_PLATFORM_HAIKU +#include +#endif #define MAX_BUTTONS 16 @@ -878,6 +881,9 @@ device->active = false; } +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + devfs_unpublish_device(device->name, true); +#endif return B_OK; } @@ -971,6 +977,8 @@ err = handle_interrupt_transfer(device); if (err != B_OK) return err; + } else if (err == B_INTERRUPTED) { + continue; } else { return err; } @@ -985,22 +993,32 @@ case KB_SET_LEDS: set_leds(device, (uint8 *)arg); return B_OK; + + default: + /* not implemented */ + return B_ERROR; } } else { switch (op) { case MS_READ: while (ring_buffer_readable(device->rbuf) == 0) { - err = schedule_interrupt_transfer(device); - if (err != B_OK) - return err; - // NOTE: this thread is now blocking until - // the semaphore will be released from the - // call_back function + if (!device->transfer_scheduled) { + err = schedule_interrupt_transfer(device); + if (err != B_OK) + return err; + device->transfer_scheduled = true; + // NOTE: this thread is now blocking until + // the semaphore will be released from the + // call_back function + } err = acquire_sem_etc(device->sem_cb, 1, B_CAN_INTERRUPT, 0LL); - if (err != B_OK) + if (err == B_INTERRUPTED) + continue; + else if (err != B_OK) return err; + device->transfer_scheduled = false; err = handle_interrupt_transfer(device); if (err != B_OK) return err; From mmu_man at mail.berlios.de Fri Jan 11 20:04:19 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 20:04:19 +0100 Subject: [Haiku-commits] r23413 - haiku/trunk/3rdparty/themes Message-ID: <200801111904.m0BJ4Jle014132@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 20:04:19 +0100 (Fri, 11 Jan 2008) New Revision: 23413 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23413&view=rev Added: haiku/trunk/3rdparty/themes/TextInputAlert.cpp haiku/trunk/3rdparty/themes/TextInputAlert.h Modified: haiku/trunk/3rdparty/themes/Jamfile haiku/trunk/3rdparty/themes/ThemeInterfaceView.cpp Log: A stub replacement for that popup text input class. Modified: haiku/trunk/3rdparty/themes/Jamfile =================================================================== --- haiku/trunk/3rdparty/themes/Jamfile 2008-01-11 18:53:39 UTC (rev 23412) +++ haiku/trunk/3rdparty/themes/Jamfile 2008-01-11 19:04:19 UTC (rev 23413) @@ -26,11 +26,11 @@ FileUtils.cpp MakeScreenshot.cpp ParseMessage.cpp + TextInputAlert.cpp ThemeAddonItem.cpp ThemeInterfaceView.cpp ThemeItem.cpp ThemeManager.cpp - ThemePopupTextWindow.cpp ThemesAddon.cpp ViewItem.cpp $(addonSources) Added: haiku/trunk/3rdparty/themes/TextInputAlert.cpp =================================================================== --- haiku/trunk/3rdparty/themes/TextInputAlert.cpp 2008-01-11 18:53:39 UTC (rev 23412) +++ haiku/trunk/3rdparty/themes/TextInputAlert.cpp 2008-01-11 19:04:19 UTC (rev 23413) @@ -0,0 +1,21 @@ +#include "TextInputAlert.h" + + +TextInputAlert::TextInputAlert(const char *title, + const char *text, + const char *initial, /* initial input value */ + const char *button0Label, + const char *button1Label, + const char *button2Label, + button_width widthStyle, + alert_type type) + : BAlert(title, text, button0Label, button1Label, button2Label, widthStyle, type) +{ +} + + +TextInputAlert::~TextInputAlert() +{ +} + + Added: haiku/trunk/3rdparty/themes/TextInputAlert.h =================================================================== --- haiku/trunk/3rdparty/themes/TextInputAlert.h 2008-01-11 18:53:39 UTC (rev 23412) +++ haiku/trunk/3rdparty/themes/TextInputAlert.h 2008-01-11 19:04:19 UTC (rev 23413) @@ -0,0 +1,21 @@ +#ifndef TEXT_INPUT_ALERT_H +#define TEXT_INPUT_ALERT_H + +#include + +class TextInputAlert : public BAlert { + public: + TextInputAlert(const char *title, + const char *text, + const char *initial, /* initial input value */ + const char *button0Label, + const char *button1Label = NULL, + const char *button2Label = NULL, + button_width widthStyle = B_WIDTH_AS_USUAL, + alert_type type = B_INFO_ALERT); + virtual ~TextInputAlert(); + +}; + +#endif /* TEXT_INPUT_ALERT_H */ + Modified: haiku/trunk/3rdparty/themes/ThemeInterfaceView.cpp =================================================================== --- haiku/trunk/3rdparty/themes/ThemeInterfaceView.cpp 2008-01-11 18:53:39 UTC (rev 23412) +++ haiku/trunk/3rdparty/themes/ThemeInterfaceView.cpp 2008-01-11 19:04:19 UTC (rev 23413) @@ -22,6 +22,7 @@ #include #include "UITheme.h" +#include "TextInputAlert.h" extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap); @@ -193,11 +194,13 @@ ((fBox->Frame().Height() - fScreenshotNone->Frame().Height()) / 2.0)); // Theme hyperlink + /* BStringView* hlink = new BStringView(BRect(), "theme_hyperlink", _T("More themes online"), new BMessage(skOnlineThemes), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); AddChild(hlink); hlink->SetClickText(hlink->GetText(), *this); hlink->ResizeToPreferred(); hlink->MoveTo(frame.right - hlink->Bounds().Width(), fNewBtn->Frame().top + 5); + */ // the addons list view preview_frame = fBox->Frame(); @@ -247,12 +250,8 @@ case kCreateThemeBtn: { - ThemePopupTextWindow *tw; - tw = new ThemePopupTextWindow(_T("New Theme Name"), _T("Name"), _T("Accept"), _T("Cancel"), - new BMessage(kReallyCreateTheme), - new BMessage(kReallyCreateTheme+1)); - tw->SetTarget(this); - tw->Show(); + TextInputAlert *alert = new TextInputAlert("New name", "New Theme Name", "", "Ok", "Cancel"); + alert->Go(fPopupInvoker); break; } From mmu_man at mail.berlios.de Fri Jan 11 20:05:14 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 20:05:14 +0100 Subject: [Haiku-commits] r23414 - haiku/trunk/3rdparty Message-ID: <200801111905.m0BJ5Et5014286@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 20:05:14 +0100 (Fri, 11 Jan 2008) New Revision: 23414 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23414&view=rev Added: haiku/trunk/3rdparty/mmu_man/ Log: I'm a vendor now! :) From axeld at mail.berlios.de Fri Jan 11 20:10:02 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 11 Jan 2008 20:10:02 +0100 Subject: [Haiku-commits] r23415 - in haiku/trunk/src/tests/servers/app: . workspace_switcher Message-ID: <200801111910.m0BJA2aK014610@sheep.berlios.de> Author: axeld Date: 2008-01-11 20:10:01 +0100 (Fri, 11 Jan 2008) New Revision: 23415 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23415&view=rev Added: haiku/trunk/src/tests/servers/app/workspace_switcher/ haiku/trunk/src/tests/servers/app/workspace_switcher/Jamfile haiku/trunk/src/tests/servers/app/workspace_switcher/workspace_switcher.cpp Modified: haiku/trunk/src/tests/servers/app/Jamfile Log: A test app that does constant workspace switching. Modified: haiku/trunk/src/tests/servers/app/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/app/Jamfile 2008-01-11 19:05:14 UTC (rev 23414) +++ haiku/trunk/src/tests/servers/app/Jamfile 2008-01-11 19:10:01 UTC (rev 23415) @@ -182,3 +182,4 @@ SubInclude HAIKU_TOP src tests servers app textview ; SubInclude HAIKU_TOP src tests servers app view_state ; SubInclude HAIKU_TOP src tests servers app window_creation ; +SubInclude HAIKU_TOP src tests servers app workspace_switcher ; Added: haiku/trunk/src/tests/servers/app/workspace_switcher/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/app/workspace_switcher/Jamfile 2008-01-11 19:05:14 UTC (rev 23414) +++ haiku/trunk/src/tests/servers/app/workspace_switcher/Jamfile 2008-01-11 19:10:01 UTC (rev 23415) @@ -0,0 +1,18 @@ +SubDir HAIKU_TOP src tests servers app workspace_switcher ; + +SetSubDirSupportedPlatformsBeOSCompatible ; +AddSubDirSupportedPlatforms libbe_test ; + +UseHeaders [ FDirName os app ] ; +UseHeaders [ FDirName os interface ] ; + +Application workspace_switcher : + workspace_switcher.cpp + : be +; + +if $(TARGET_PLATFORM) = libbe_test { + HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : workspace_switcher + : tests!apps ; +} + Added: haiku/trunk/src/tests/servers/app/workspace_switcher/workspace_switcher.cpp =================================================================== --- haiku/trunk/src/tests/servers/app/workspace_switcher/workspace_switcher.cpp 2008-01-11 19:05:14 UTC (rev 23414) +++ haiku/trunk/src/tests/servers/app/workspace_switcher/workspace_switcher.cpp 2008-01-11 19:10:01 UTC (rev 23415) @@ -0,0 +1,24 @@ +/* + * Copyright 2008, Haiku Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel D?rfler, axeld at pinc-software.de + */ + + +#include + + +int +main() +{ + BApplication app("application/x-vnd.Haiku-test-wss"); + + while (true) { + activate_workspace(0); + snooze(3000); + activate_workspace(1); + } +} + From mmu_man at mail.berlios.de Fri Jan 11 20:10:09 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 20:10:09 +0100 Subject: [Haiku-commits] r23416 - haiku/trunk/3rdparty Message-ID: <200801111910.m0BJA9T2014658@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 20:10:09 +0100 (Fri, 11 Jan 2008) New Revision: 23416 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23416&view=rev Modified: haiku/trunk/3rdparty/Jamfile Log: Unhook themes when moving it to vendor folder. Modified: haiku/trunk/3rdparty/Jamfile =================================================================== --- haiku/trunk/3rdparty/Jamfile 2008-01-11 19:10:01 UTC (rev 23415) +++ haiku/trunk/3rdparty/Jamfile 2008-01-11 19:10:09 UTC (rev 23416) @@ -1,3 +1,3 @@ SubDir HAIKU_TOP 3rdparty ; -SubInclude HAIKU_TOP 3rdparty themes ; +#SubInclude HAIKU_TOP 3rdparty mmu_man ; From mmu_man at mail.berlios.de Fri Jan 11 21:42:27 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 21:42:27 +0100 Subject: [Haiku-commits] r23417 - in haiku/trunk/3rdparty: . mmu_man mmu_man/themes Message-ID: <200801112042.m0BKgRUQ023531@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 21:42:27 +0100 (Fri, 11 Jan 2008) New Revision: 23417 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23417&view=rev Added: haiku/trunk/3rdparty/mmu_man/themes/ haiku/trunk/3rdparty/mmu_man/themes/Jamfile haiku/trunk/3rdparty/mmu_man/themes/TextInputAlert.cpp haiku/trunk/3rdparty/mmu_man/themes/TextInputAlert.h haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp Removed: haiku/trunk/3rdparty/mmu_man/themes/Jamfile haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp haiku/trunk/3rdparty/themes/ Log: Move Themes to vendor folder. Copied: haiku/trunk/3rdparty/mmu_man/themes (from rev 23406, haiku/trunk/3rdparty/themes) Deleted: haiku/trunk/3rdparty/mmu_man/themes/Jamfile Copied: haiku/trunk/3rdparty/mmu_man/themes/Jamfile (from rev 23416, haiku/trunk/3rdparty/themes/Jamfile) Copied: haiku/trunk/3rdparty/mmu_man/themes/TextInputAlert.cpp (from rev 23416, haiku/trunk/3rdparty/themes/TextInputAlert.cpp) Copied: haiku/trunk/3rdparty/mmu_man/themes/TextInputAlert.h (from rev 23416, haiku/trunk/3rdparty/themes/TextInputAlert.h) Deleted: haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp Copied: haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp (from rev 23416, haiku/trunk/3rdparty/themes/ThemeInterfaceView.cpp) From mmu_man at mail.berlios.de Fri Jan 11 21:57:24 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 21:57:24 +0100 Subject: [Haiku-commits] r23418 - in haiku/trunk/3rdparty: . mmu_man Message-ID: <200801112057.m0BKvOHO024207@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 21:57:24 +0100 (Fri, 11 Jan 2008) New Revision: 23418 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23418&view=rev Added: haiku/trunk/3rdparty/mmu_man/onlinedemo/ Removed: haiku/trunk/3rdparty/onlinedemo/ Log: Move online demo php to vendor. Copied: haiku/trunk/3rdparty/mmu_man/onlinedemo (from rev 23416, haiku/trunk/3rdparty/onlinedemo) From mmu_man at mail.berlios.de Fri Jan 11 23:11:19 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Jan 2008 23:11:19 +0100 Subject: [Haiku-commits] r23419 - in haiku/trunk/3rdparty: . mmu_man mmu_man/themes Message-ID: <200801112211.m0BMBJMZ028796@sheep.berlios.de> Author: mmu_man Date: 2008-01-11 23:11:18 +0100 (Fri, 11 Jan 2008) New Revision: 23419 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23419&view=rev Added: haiku/trunk/3rdparty/mmu_man/Jamfile haiku/trunk/3rdparty/mmu_man/themes/ThemesApp.cpp haiku/trunk/3rdparty/mmu_man/themes/ThemesApp.h Modified: haiku/trunk/3rdparty/Jamfile haiku/trunk/3rdparty/mmu_man/themes/Jamfile haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.h Log: It now builds as a standalone app for Zeta. Even still works :)) Modified: haiku/trunk/3rdparty/Jamfile =================================================================== --- haiku/trunk/3rdparty/Jamfile 2008-01-11 20:57:24 UTC (rev 23418) +++ haiku/trunk/3rdparty/Jamfile 2008-01-11 22:11:18 UTC (rev 23419) @@ -1,3 +1,3 @@ SubDir HAIKU_TOP 3rdparty ; -#SubInclude HAIKU_TOP 3rdparty mmu_man ; +SubInclude HAIKU_TOP 3rdparty mmu_man ; Added: haiku/trunk/3rdparty/mmu_man/Jamfile =================================================================== --- haiku/trunk/3rdparty/mmu_man/Jamfile 2008-01-11 20:57:24 UTC (rev 23418) +++ haiku/trunk/3rdparty/mmu_man/Jamfile 2008-01-11 22:11:18 UTC (rev 23419) @@ -0,0 +1,3 @@ +SubDir HAIKU_TOP 3rdparty mmu_man ; + +SubInclude HAIKU_TOP 3rdparty mmu_man themes ; Modified: haiku/trunk/3rdparty/mmu_man/themes/Jamfile =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/Jamfile 2008-01-11 20:57:24 UTC (rev 23418) +++ haiku/trunk/3rdparty/mmu_man/themes/Jamfile 2008-01-11 22:11:18 UTC (rev 23419) @@ -1,9 +1,11 @@ -SubDir HAIKU_TOP 3rdparty themes ; +SubDir HAIKU_TOP 3rdparty mmu_man themes ; SetSubDirSupportedPlatformsBeOSCompatible ; -SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) 3rdparty themes addons ] ; +SubDirC++Flags -DSINGLE_BINARY ; +SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) 3rdparty mmu_man themes addons ] ; + local addonSources ; addonSources = BackgroundsAddon.cpp @@ -28,6 +30,7 @@ ParseMessage.cpp TextInputAlert.cpp ThemeAddonItem.cpp + ThemesApp.cpp ThemeInterfaceView.cpp ThemeItem.cpp ThemeManager.cpp Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.h =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.h 2008-01-11 20:57:24 UTC (rev 23418) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.h 2008-01-11 22:11:18 UTC (rev 23419) @@ -16,6 +16,7 @@ class BTextView; class BMessage; class BStringView; +class BInvoker; class ThemeInterfaceView : public BView { Added: haiku/trunk/3rdparty/mmu_man/themes/ThemesApp.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemesApp.cpp 2008-01-11 20:57:24 UTC (rev 23418) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemesApp.cpp 2008-01-11 22:11:18 UTC (rev 23419) @@ -0,0 +1,52 @@ +#include +#include + +#include +#include + +#include "ThemesApp.h" +#include "ThemeInterfaceView.h" + +const char *kThemesAppSig = "application/x-vnd.mmu_man-Themes"; + + +ThemesApp::ThemesApp() + : BApplication(kThemesAppSig) +{ +} + + +ThemesApp::~ThemesApp() +{ +} + + +void +ThemesApp::ReadyToRun() +{ + BScreen s; + BRect frame(0, 0, 500, 300); + frame.OffsetBySelf(s.Frame().Width()/2 - frame.Width()/2, + s.Frame().Height()/2 - frame.Height()/2); + BWindow *w = new BWindow(frame, "Themes", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_QUIT_ON_WINDOW_CLOSE); + ThemeInterfaceView *v = new ThemeInterfaceView(w->Bounds()); + w->AddChild(v); + w->Show(); +} + + +void +ThemesApp::MessageReceived(BMessage *message) +{ + switch (message->what) { + default: + BApplication::MessageReceived(message); + } +} + + +int main(int argc, char **argv) +{ + ThemesApp app; + app.Run(); +} Added: haiku/trunk/3rdparty/mmu_man/themes/ThemesApp.h =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemesApp.h 2008-01-11 20:57:24 UTC (rev 23418) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemesApp.h 2008-01-11 22:11:18 UTC (rev 23419) @@ -0,0 +1,11 @@ +#include + +class ThemesApp : public BApplication { +public: + ThemesApp(); + virtual ~ThemesApp(); + void ReadyToRun(); + void MessageReceived(BMessage *message); + +private: +}; From colacoder at mail.berlios.de Fri Jan 11 23:12:50 2008 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Fri, 11 Jan 2008 23:12:50 +0100 Subject: [Haiku-commits] r23420 - haiku/trunk/src/add-ons/kernel/drivers/network/stack Message-ID: <200801112212.m0BMCoAG028934@sheep.berlios.de> Author: colacoder Date: 2008-01-11 23:12:50 +0100 (Fri, 11 Jan 2008) New Revision: 23420 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23420&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/network/stack/kernel_stack.cpp Log: Fix problem of accept() not accepting a bigger buffer for the sockaddr then required (cupsd exposed this bug) Modified: haiku/trunk/src/add-ons/kernel/drivers/network/stack/kernel_stack.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/stack/kernel_stack.cpp 2008-01-11 22:11:18 UTC (rev 23419) +++ haiku/trunk/src/add-ons/kernel/drivers/network/stack/kernel_stack.cpp 2008-01-11 22:12:50 UTC (rev 23420) @@ -84,7 +84,7 @@ if (user_memcpy(&args, data, sizeof(ArgType)) < B_OK) return B_BAD_ADDRESS; - if (args.address_length > sizeof(sockaddr_storage)) + if (copyAddress && args.address_length > sizeof(sockaddr_storage)) return B_BAD_VALUE; if (copyAddress && user_memcpy(&address, args.address, args.address_length) < B_OK) From stippi at mail.berlios.de Fri Jan 11 23:25:08 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 11 Jan 2008 23:25:08 +0100 Subject: [Haiku-commits] r23421 - haiku/trunk/src/add-ons/input_server/devices/mouse Message-ID: <200801112225.m0BMP8Yv029670@sheep.berlios.de> Author: stippi Date: 2008-01-11 23:25:08 +0100 (Fri, 11 Jan 2008) New Revision: 23421 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23421&view=rev Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp Log: * at least with the BeOS input_server it is important that the last B_MOUSE_MOVED message does not already contain the same buttons as a following B_MOUSE_DOWN message... fixes mouse clicks being ignored when you are moving the mouse at the same time when clicking (using Haiku's mouse input_server device on BeOS or ZETA) Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-01-11 22:12:50 UTC (rev 23420) +++ haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-01-11 22:25:08 UTC (rev 23421) @@ -259,13 +259,6 @@ // Send single messages for each event - if (movements.xdelta != 0 || movements.ydelta != 0) { - BMessage* message = _BuildMouseMessage(B_MOUSE_MOVED, movements.timestamp, - remappedButtons, deltaX, deltaY); - if (message != NULL) - fTarget.EnqueueMessage(message); - } - if (buttons != 0) { bool pressedButton = (buttons & movements.buttons) > 0; BMessage* message = _BuildMouseMessage( @@ -283,6 +276,13 @@ } } + if (movements.xdelta != 0 || movements.ydelta != 0) { + BMessage* message = _BuildMouseMessage(B_MOUSE_MOVED, + movements.timestamp, remappedButtons, deltaX, deltaY); + if (message != NULL) + fTarget.EnqueueMessage(message); + } + if ((movements.wheel_ydelta != 0) || (movements.wheel_xdelta != 0)) { message = new BMessage(B_MOUSE_WHEEL_CHANGED); if (message == NULL) From stippi at mail.berlios.de Fri Jan 11 23:25:41 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 11 Jan 2008 23:25:41 +0100 Subject: [Haiku-commits] r23422 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200801112225.m0BMPfeX029718@sheep.berlios.de> Author: stippi Date: 2008-01-11 23:25:41 +0100 (Fri, 11 Jan 2008) New Revision: 23422 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23422&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c Log: * small style cleanup Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-11 22:25:08 UTC (rev 23421) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-11 22:25:41 UTC (rev 23422) @@ -531,10 +531,9 @@ memset(&info, 0, sizeof(info)); for (i = 0; i < device->num_insns; i++) { - const report_insn *insn = &device->insns [i]; - int32 value = - (((report [insn->byte_idx + 1] << 8) | - report [insn->byte_idx]) >> insn->bit_pos) + const report_insn *insn = &device->insns[i]; + int32 value = (((report[insn->byte_idx + 1] << 8) + | report[insn->byte_idx]) >> insn->bit_pos) & ((1 << insn->num_bits) - 1); if (insn->usage_page == USAGE_PAGE_BUTTON) { From mmlr at mail.berlios.de Fri Jan 11 23:45:08 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 11 Jan 2008 23:45:08 +0100 Subject: [Haiku-commits] r23423 - in haiku/trunk: headers/private/storage/mime src/kits/storage src/kits/storage/mime src/servers/registrar src/servers/registrar/mime Message-ID: <200801112245.m0BMj8IT031090@sheep.berlios.de> Author: mmlr Date: 2008-01-11 23:45:06 +0100 (Fri, 11 Jan 2008) New Revision: 23423 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23423&view=rev Added: haiku/trunk/src/servers/registrar/mime/ haiku/trunk/src/servers/registrar/mime/AssociatedTypes.h haiku/trunk/src/servers/registrar/mime/CreateAppMetaMimeThread.h haiku/trunk/src/servers/registrar/mime/Database.h haiku/trunk/src/servers/registrar/mime/InstalledTypes.h haiku/trunk/src/servers/registrar/mime/MimeSnifferAddonManager.h haiku/trunk/src/servers/registrar/mime/MimeUpdateThread.h haiku/trunk/src/servers/registrar/mime/SnifferRules.h haiku/trunk/src/servers/registrar/mime/Supertype.h haiku/trunk/src/servers/registrar/mime/SupportingApps.h haiku/trunk/src/servers/registrar/mime/UpdateMimeInfoThread.h Removed: haiku/trunk/headers/private/storage/mime/AssociatedTypes.h haiku/trunk/headers/private/storage/mime/CreateAppMetaMimeThread.h haiku/trunk/headers/private/storage/mime/Database.h haiku/trunk/headers/private/storage/mime/InstalledTypes.h haiku/trunk/headers/private/storage/mime/MimeSnifferAddonManager.h haiku/trunk/headers/private/storage/mime/MimeUpdateThread.h haiku/trunk/headers/private/storage/mime/SnifferRules.h haiku/trunk/headers/private/storage/mime/Supertype.h haiku/trunk/headers/private/storage/mime/SupportingApps.h haiku/trunk/headers/private/storage/mime/UpdateMimeInfoThread.h haiku/trunk/src/kits/storage/mime/AssociatedTypes.cpp haiku/trunk/src/kits/storage/mime/CreateAppMetaMimeThread.cpp haiku/trunk/src/kits/storage/mime/Database.cpp haiku/trunk/src/kits/storage/mime/InstalledTypes.cpp haiku/trunk/src/kits/storage/mime/MimeSnifferAddon.cpp haiku/trunk/src/kits/storage/mime/MimeSnifferAddonManager.cpp haiku/trunk/src/kits/storage/mime/MimeUpdateThread.cpp haiku/trunk/src/kits/storage/mime/SnifferRules.cpp haiku/trunk/src/kits/storage/mime/Supertype.cpp haiku/trunk/src/kits/storage/mime/SupportingApps.cpp haiku/trunk/src/kits/storage/mime/UpdateMimeInfoThread.cpp haiku/trunk/src/servers/registrar/mime/database_access.cpp haiku/trunk/src/servers/registrar/mime/database_support.cpp Modified: haiku/trunk/src/kits/storage/Jamfile haiku/trunk/src/servers/registrar/Jamfile haiku/trunk/src/servers/registrar/MIMEManager.cpp haiku/trunk/src/servers/registrar/MIMEManager.h haiku/trunk/src/servers/registrar/mime/AssociatedTypes.cpp haiku/trunk/src/servers/registrar/mime/CreateAppMetaMimeThread.cpp haiku/trunk/src/servers/registrar/mime/Database.cpp haiku/trunk/src/servers/registrar/mime/InstalledTypes.cpp haiku/trunk/src/servers/registrar/mime/MimeSnifferAddon.cpp haiku/trunk/src/servers/registrar/mime/MimeSnifferAddonManager.cpp haiku/trunk/src/servers/registrar/mime/MimeUpdateThread.cpp haiku/trunk/src/servers/registrar/mime/SnifferRules.cpp haiku/trunk/src/servers/registrar/mime/Supertype.cpp haiku/trunk/src/servers/registrar/mime/SupportingApps.cpp haiku/trunk/src/servers/registrar/mime/UpdateMimeInfoThread.cpp Log: bonefish+mmlr: * Move most of MIME database support out of libbe and into registrar * Use the (async) MessageDeliverer instead of a synchronous SendMessage in _SendMonitorUpdate This fixes a deadlock when the message port of a MIME database watching application gets full as documented in bug #1311. Deleted: haiku/trunk/headers/private/storage/mime/AssociatedTypes.h Deleted: haiku/trunk/headers/private/storage/mime/CreateAppMetaMimeThread.h Deleted: haiku/trunk/headers/private/storage/mime/Database.h Deleted: haiku/trunk/headers/private/storage/mime/InstalledTypes.h Deleted: haiku/trunk/headers/private/storage/mime/MimeSnifferAddonManager.h Deleted: haiku/trunk/headers/private/storage/mime/MimeUpdateThread.h Deleted: haiku/trunk/headers/private/storage/mime/SnifferRules.h Deleted: haiku/trunk/headers/private/storage/mime/Supertype.h Deleted: haiku/trunk/headers/private/storage/mime/SupportingApps.h Deleted: haiku/trunk/headers/private/storage/mime/UpdateMimeInfoThread.h Modified: haiku/trunk/src/kits/storage/Jamfile =================================================================== --- haiku/trunk/src/kits/storage/Jamfile 2008-01-11 22:25:41 UTC (rev 23422) +++ haiku/trunk/src/kits/storage/Jamfile 2008-01-11 22:45:06 UTC (rev 23423) @@ -45,17 +45,6 @@ storage_support.cpp # mime - AssociatedTypes.cpp - CreateAppMetaMimeThread.cpp - Database.cpp - InstalledTypes.cpp - MimeSnifferAddon.cpp - MimeSnifferAddonManager.cpp - MimeUpdateThread.cpp - SnifferRules.cpp - Supertype.cpp - SupportingApps.cpp - UpdateMimeInfoThread.cpp database_access.cpp database_support.cpp Deleted: haiku/trunk/src/kits/storage/mime/AssociatedTypes.cpp Deleted: haiku/trunk/src/kits/storage/mime/CreateAppMetaMimeThread.cpp Deleted: haiku/trunk/src/kits/storage/mime/Database.cpp Deleted: haiku/trunk/src/kits/storage/mime/InstalledTypes.cpp Deleted: haiku/trunk/src/kits/storage/mime/MimeSnifferAddon.cpp Deleted: haiku/trunk/src/kits/storage/mime/MimeSnifferAddonManager.cpp Deleted: haiku/trunk/src/kits/storage/mime/MimeUpdateThread.cpp Deleted: haiku/trunk/src/kits/storage/mime/SnifferRules.cpp Deleted: haiku/trunk/src/kits/storage/mime/Supertype.cpp Deleted: haiku/trunk/src/kits/storage/mime/SupportingApps.cpp Deleted: haiku/trunk/src/kits/storage/mime/UpdateMimeInfoThread.cpp Modified: haiku/trunk/src/servers/registrar/Jamfile =================================================================== --- haiku/trunk/src/servers/registrar/Jamfile 2008-01-11 22:25:41 UTC (rev 23422) +++ haiku/trunk/src/servers/registrar/Jamfile 2008-01-11 22:45:06 UTC (rev 23423) @@ -7,6 +7,8 @@ UsePrivateHeaders tracker ; UseArchHeaders $(TARGET_ARCH) ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) mime ] ; + Server registrar : AppInfoList.cpp @@ -33,6 +35,19 @@ TRoster.cpp Watcher.cpp WatchingService.cpp + + # mime + AssociatedTypes.cpp + CreateAppMetaMimeThread.cpp + Database.cpp + InstalledTypes.cpp + MimeSnifferAddon.cpp + MimeSnifferAddonManager.cpp + MimeUpdateThread.cpp + SnifferRules.cpp + Supertype.cpp + SupportingApps.cpp + UpdateMimeInfoThread.cpp : be $(TARGET_LIBSTDC++) Modified: haiku/trunk/src/servers/registrar/MIMEManager.cpp =================================================================== --- haiku/trunk/src/servers/registrar/MIMEManager.cpp 2008-01-11 22:25:41 UTC (rev 23422) +++ haiku/trunk/src/servers/registrar/MIMEManager.cpp 2008-01-11 22:45:06 UTC (rev 23423) @@ -1,26 +1,27 @@ // MIMEManager.cpp +#include "MIMEManager.h" + +#include +#include + #include #include #include #include -#include -#include -#include #include #include #include #include -#include -#include +#include "CreateAppMetaMimeThread.h" +#include "MimeSnifferAddonManager.h" +#include "TextSnifferAddon.h" +#include "UpdateMimeInfoThread.h" using namespace std; using namespace BPrivate; -#include "MIMEManager.h" -#include "TextSnifferAddon.h" - /*! \class MIMEManager \brief MIMEManager handles communication between BMimeType and the system-wide Modified: haiku/trunk/src/servers/registrar/MIMEManager.h =================================================================== --- haiku/trunk/src/servers/registrar/MIMEManager.h 2008-01-11 22:25:41 UTC (rev 23422) +++ haiku/trunk/src/servers/registrar/MIMEManager.h 2008-01-11 22:45:06 UTC (rev 23423) @@ -4,9 +4,10 @@ #define MIME_MANAGER_H #include -#include #include +#include "Database.h" + class MIMEManager : public BLooper { public: MIMEManager(); Copied: haiku/trunk/src/servers/registrar/mime (from rev 23399, haiku/trunk/src/kits/storage/mime) Modified: haiku/trunk/src/servers/registrar/mime/AssociatedTypes.cpp =================================================================== --- haiku/trunk/src/kits/storage/mime/AssociatedTypes.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/AssociatedTypes.cpp 2008-01-11 22:45:06 UTC (rev 23423) @@ -7,7 +7,8 @@ AssociatedTypes class implementation */ -#include "mime/AssociatedTypes.h" +#include "AssociatedTypes.h" +#include "MimeSnifferAddonManager.h" #include #include @@ -16,7 +17,6 @@ #include #include #include -#include #include #include Copied: haiku/trunk/src/servers/registrar/mime/AssociatedTypes.h (from rev 23399, haiku/trunk/headers/private/storage/mime/AssociatedTypes.h) Modified: haiku/trunk/src/servers/registrar/mime/CreateAppMetaMimeThread.cpp =================================================================== --- haiku/trunk/src/kits/storage/mime/CreateAppMetaMimeThread.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/CreateAppMetaMimeThread.cpp 2008-01-11 22:45:06 UTC (rev 23423) @@ -8,9 +8,10 @@ */ -#include "mime/CreateAppMetaMimeThread.h" -#include "mime/database_support.h" +#include "CreateAppMetaMimeThread.h" +#include + #include #include #include @@ -19,9 +20,8 @@ #include #include -#include +#include - namespace BPrivate { namespace Storage { namespace Mime { Copied: haiku/trunk/src/servers/registrar/mime/CreateAppMetaMimeThread.h (from rev 23399, haiku/trunk/headers/private/storage/mime/CreateAppMetaMimeThread.h) =================================================================== --- haiku/trunk/headers/private/storage/mime/CreateAppMetaMimeThread.h 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/CreateAppMetaMimeThread.h 2008-01-11 22:45:06 UTC (rev 23423) @@ -0,0 +1,31 @@ +//---------------------------------------------------------------------- +// This software is part of the OpenBeOS distribution and is covered +// by the OpenBeOS license. +//--------------------------------------------------------------------- +/*! + \file CreateAppMetaMimeThread.h + CreateAppMetaMimeThread interface declaration +*/ + +#ifndef _CREATE_APP_META_MIME_THREAD_H +#define _CREATE_APP_META_MIME_THREAD_H + +#include "MimeUpdateThread.h" + +namespace BPrivate { +namespace Storage { +namespace Mime { + +class CreateAppMetaMimeThread : public MimeUpdateThread { +public: + CreateAppMetaMimeThread(const char *name, int32 priority, + BMessenger managerMessenger, const entry_ref *root, bool recursive, + int32 force, BMessage *replyee); + status_t DoMimeUpdate(const entry_ref *entry, bool *entryIsDir); +}; + +} // namespace Mime +} // namespace Storage +} // namespace BPrivate + +#endif // _CREATE_APP_META_MIME_THREAD_H Modified: haiku/trunk/src/servers/registrar/mime/Database.cpp =================================================================== --- haiku/trunk/src/kits/storage/mime/Database.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/Database.cpp 2008-01-11 22:45:06 UTC (rev 23423) @@ -8,7 +8,7 @@ */ -#include +#include "Database.h" #include #include @@ -34,6 +34,7 @@ #include #include +#include "MessageDeliverer.h" //#define DBG(x) x #define DBG(x) @@ -1374,9 +1375,9 @@ status_t err; std::set::const_iterator i; for (i = fMonitorMessengers.begin(); i != fMonitorMessengers.end(); i++) { - status_t err = (*i).SendMessage(&msg, (BHandler*)NULL); + status_t err = MessageDeliverer::Default()->DeliverMessage(&msg, *i); if (err) { - DBG(OUT("Database::_SendMonitorUpdate(BMessage&): BMessenger::SendMessage failed, 0x%lx\n", err)); + DBG(OUT("Database::_SendMonitorUpdate(BMessage&): DeliverMessage failed, 0x%lx\n", err)); } } // DBG(OUT("Database::_SendMonitorUpdate(BMessage&) done\n")); Copied: haiku/trunk/src/servers/registrar/mime/Database.h (from rev 23399, haiku/trunk/headers/private/storage/mime/Database.h) =================================================================== --- haiku/trunk/headers/private/storage/mime/Database.h 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/Database.h 2008-01-11 22:45:06 UTC (rev 23423) @@ -0,0 +1,136 @@ +/* + * Copyright 2002-2006, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Tyler Dauwalder + */ +#ifndef _MIME_DATABASE_H +#define _MIME_DATABASE_H + +#include +#include +#include + +#include +#include +#include + +#include + +#include "AssociatedTypes.h" +#include "InstalledTypes.h" +#include "SnifferRules.h" +#include "SupportingApps.h" + + +class BNode; +class BBitmap; +class BMessage; +class BString; + +struct entry_ref; + +namespace BPrivate { +namespace Storage { +namespace Mime { + +// types of mime update functions that may be run asynchronously +typedef enum { + B_REG_UPDATE_MIME_INFO, + B_REG_CREATE_APP_META_MIME, +} mime_update_function; + +class Database { + public: + Database(); + ~Database(); + + status_t InitCheck() const; + + // Type management + status_t Install(const char *type); + status_t Delete(const char *type); + + // Set() + status_t SetAppHint(const char *type, const entry_ref *ref); + status_t SetAttrInfo(const char *type, const BMessage *info); + status_t SetShortDescription(const char *type, const char *description); + status_t SetLongDescription(const char *type, const char *description); + status_t SetFileExtensions(const char *type, const BMessage *extensions); + status_t SetIcon(const char *type, const void *data, size_t dataSize, + icon_size which); + status_t SetIcon(const char *type, const void *data, size_t dataSize); + status_t SetIconForType(const char *type, const char *fileType, + const void *data, size_t dataSize, icon_size which); + status_t SetIconForType(const char *type, const char *fileType, + const void *data, size_t dataSize); + status_t SetPreferredApp(const char *type, const char *signature, + app_verb verb = B_OPEN); + status_t SetSnifferRule(const char *type, const char *rule); + status_t SetSupportedTypes(const char *type, const BMessage *types, bool fullSync); + + // Non-atomic Get() + status_t GetInstalledSupertypes(BMessage *super_types); + status_t GetInstalledTypes(BMessage *types); + status_t GetInstalledTypes(const char *super_type, + BMessage *subtypes); + status_t GetSupportingApps(const char *type, BMessage *signatures); + status_t GetAssociatedTypes(const char *extension, BMessage *types); + + // Sniffer + status_t GuessMimeType(const entry_ref *file, BString *result); + status_t GuessMimeType(const void *buffer, int32 length, BString *result); + status_t GuessMimeType(const char *filename, BString *result); + + // Monitor + status_t StartWatching(BMessenger target); + status_t StopWatching(BMessenger target); + + // Delete() + status_t DeleteAppHint(const char *type); + status_t DeleteAttrInfo(const char *type); + status_t DeleteShortDescription(const char *type); + status_t DeleteLongDescription(const char *type); + status_t DeleteFileExtensions(const char *type); + status_t DeleteIcon(const char *type, icon_size size); + status_t DeleteIcon(const char *type); + status_t DeleteIconForType(const char *type, const char *fileType, + icon_size which); + status_t DeleteIconForType(const char *type, const char *fileType); + status_t DeletePreferredApp(const char *type, app_verb verb = B_OPEN); + status_t DeleteSnifferRule(const char *type); + status_t DeleteSupportedTypes(const char *type, bool fullSync); + + private: + status_t _SetStringValue(const char *type, int32 what, + const char* attribute, type_code attributeType, + size_t maxLength, const char *value); + + // Functions to send monitor notifications + status_t _SendInstallNotification(const char *type); + status_t _SendDeleteNotification(const char *type); + status_t _SendMonitorUpdate(int32 which, const char *type, + const char *extraType, bool largeIcon, int32 action); + status_t _SendMonitorUpdate(int32 which, const char *type, + const char *extraType, int32 action); + status_t _SendMonitorUpdate(int32 which, const char *type, + bool largeIcon, int32 action); + status_t _SendMonitorUpdate(int32 which, const char *type, + int32 action); + status_t _SendMonitorUpdate(BMessage &msg); + + private: + status_t fStatus; + std::set fMonitorMessengers; + AssociatedTypes fAssociatedTypes; + InstalledTypes fInstalledTypes; + SnifferRules fSnifferRules; + SupportingApps fSupportingApps; +}; + +} // namespace Mime +} // namespace Storage +} // namespace BPrivate + +#endif // _MIME_DATABASE_H Modified: haiku/trunk/src/servers/registrar/mime/InstalledTypes.cpp =================================================================== --- haiku/trunk/src/kits/storage/mime/InstalledTypes.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/InstalledTypes.cpp 2008-01-11 22:45:06 UTC (rev 23423) @@ -9,7 +9,8 @@ */ -#include "mime/InstalledTypes.h" +#include "InstalledTypes.h" + #include #include Copied: haiku/trunk/src/servers/registrar/mime/InstalledTypes.h (from rev 23399, haiku/trunk/headers/private/storage/mime/InstalledTypes.h) =================================================================== --- haiku/trunk/headers/private/storage/mime/InstalledTypes.h 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/InstalledTypes.h 2008-01-11 22:45:06 UTC (rev 23423) @@ -0,0 +1,65 @@ +/* + * Copyright 2002-2006, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Tyler Dauwalder + * Ingo Weinhold, bonefish at users.sf.net + * Axel D?rfler, axeld at pinc-software.de + */ +#ifndef _MIME_INSTALLED_TYPES_H +#define _MIME_INSTALLED_TYPES_H + +#include "Supertype.h" +#include + +#include +#include + +class BMessage; + +namespace BPrivate { +namespace Storage { +namespace Mime { + +class InstalledTypes { + public: + InstalledTypes(); + ~InstalledTypes(); + + status_t GetInstalledTypes(BMessage *types); + status_t GetInstalledTypes(const char *supertype, BMessage *types); + status_t GetInstalledSupertypes(BMessage *types); + + status_t AddType(const char *type); + status_t RemoveType(const char *type); + + private: + status_t _AddSupertype(const char *super, + std::map::iterator &i); + status_t _AddSubtype(const char *super, const char *sub); + status_t _AddSubtype(Supertype &super, const char *sub); + + status_t _RemoveSupertype(const char *super); + status_t _RemoveSubtype(const char *super, const char *sub); + + void _Unset(); + void _ClearCachedMessages(); + + status_t _CreateMessageWithTypes(BMessage **result) const; + status_t _CreateMessageWithSupertypes(BMessage **result) const; + void _FillMessageWithSupertypes(BMessage *msg); + + status_t _BuildInstalledTypesList(); + + std::map fSupertypes; + BMessage *fCachedMessage; + BMessage *fCachedSupertypesMessage; + bool fHaveDoneFullBuild; +}; + +} // namespace Mime +} // namespace Storage +} // namespace BPrivate + +#endif // _MIME_INSTALLED_TYPES_H Modified: haiku/trunk/src/servers/registrar/mime/MimeSnifferAddon.cpp =================================================================== --- haiku/trunk/src/kits/storage/mime/MimeSnifferAddon.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/MimeSnifferAddon.cpp 2008-01-11 22:45:06 UTC (rev 23423) @@ -3,7 +3,7 @@ * All rights reserved. Distributed under the terms of the MIT License. */ -#include +#include "MimeSnifferAddon.h" // constructor BMimeSnifferAddon::BMimeSnifferAddon() Modified: haiku/trunk/src/servers/registrar/mime/MimeSnifferAddonManager.cpp =================================================================== --- haiku/trunk/src/kits/storage/mime/MimeSnifferAddonManager.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/MimeSnifferAddonManager.cpp 2008-01-11 22:45:06 UTC (rev 23423) @@ -3,14 +3,15 @@ * All rights reserved. Distributed under the terms of the MIT License. */ -#include +#include "MimeSnifferAddonManager.h" #include #include -#include #include +#include "MimeSnifferAddon.h" + using std::nothrow; Copied: haiku/trunk/src/servers/registrar/mime/MimeSnifferAddonManager.h (from rev 23399, haiku/trunk/headers/private/storage/mime/MimeSnifferAddonManager.h) Modified: haiku/trunk/src/servers/registrar/mime/MimeUpdateThread.cpp =================================================================== --- haiku/trunk/src/kits/storage/mime/MimeUpdateThread.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/MimeUpdateThread.cpp 2008-01-11 22:45:06 UTC (rev 23423) @@ -12,6 +12,8 @@ MimeUpdateThread implementation */ +#include "MimeUpdateThread.h" + #include #include @@ -21,7 +23,6 @@ #include #include -#include "mime/MimeUpdateThread.h" //#define DBG(x) x #define DBG(x) Copied: haiku/trunk/src/servers/registrar/mime/MimeUpdateThread.h (from rev 23399, haiku/trunk/headers/private/storage/mime/MimeUpdateThread.h) Modified: haiku/trunk/src/servers/registrar/mime/SnifferRules.cpp =================================================================== --- haiku/trunk/src/kits/storage/mime/SnifferRules.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/SnifferRules.cpp 2008-01-11 22:45:06 UTC (rev 23423) @@ -12,22 +12,23 @@ SnifferRules class implementation */ -#include "mime/SnifferRules.h" +#include "SnifferRules.h" +#include +#include + #include #include #include #include #include -#include #include #include #include #include #include -#include -#include +#include "MimeSnifferAddonManager.h" #define DBG(x) x //#define DBG(x) Copied: haiku/trunk/src/servers/registrar/mime/SnifferRules.h (from rev 23399, haiku/trunk/headers/private/storage/mime/SnifferRules.h) Modified: haiku/trunk/src/servers/registrar/mime/Supertype.cpp =================================================================== --- haiku/trunk/src/kits/storage/mime/Supertype.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/Supertype.cpp 2008-01-11 22:45:06 UTC (rev 23423) @@ -7,7 +7,7 @@ Supertype class implementation */ -#include "mime/Supertype.h" +#include "Supertype.h" #include #include Copied: haiku/trunk/src/servers/registrar/mime/Supertype.h (from rev 23399, haiku/trunk/headers/private/storage/mime/Supertype.h) Modified: haiku/trunk/src/servers/registrar/mime/SupportingApps.cpp =================================================================== --- haiku/trunk/src/kits/storage/mime/SupportingApps.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/SupportingApps.cpp 2008-01-11 22:45:06 UTC (rev 23423) @@ -9,7 +9,7 @@ */ -#include +#include "SupportingApps.h" #include #include Copied: haiku/trunk/src/servers/registrar/mime/SupportingApps.h (from rev 23399, haiku/trunk/headers/private/storage/mime/SupportingApps.h) Modified: haiku/trunk/src/servers/registrar/mime/UpdateMimeInfoThread.cpp =================================================================== --- haiku/trunk/src/kits/storage/mime/UpdateMimeInfoThread.cpp 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/UpdateMimeInfoThread.cpp 2008-01-11 22:45:06 UTC (rev 23423) @@ -7,7 +7,7 @@ UpdateMimeInfoThread implementation */ -#include "mime/UpdateMimeInfoThread.h" +#include "UpdateMimeInfoThread.h" #include #include Copied: haiku/trunk/src/servers/registrar/mime/UpdateMimeInfoThread.h (from rev 23399, haiku/trunk/headers/private/storage/mime/UpdateMimeInfoThread.h) =================================================================== --- haiku/trunk/headers/private/storage/mime/UpdateMimeInfoThread.h 2008-01-11 14:17:17 UTC (rev 23399) +++ haiku/trunk/src/servers/registrar/mime/UpdateMimeInfoThread.h 2008-01-11 22:45:06 UTC (rev 23423) @@ -0,0 +1,31 @@ +//---------------------------------------------------------------------- +// This software is part of the OpenBeOS distribution and is covered +// by the OpenBeOS license. +//--------------------------------------------------------------------- +/*! + \file UpdateMimeInfoThread.h + UpdateMimeInfoThread interface declaration +*/ + +#ifndef _MIME_UPDATE_MIME_INFO_THREAD_H +#define _MIME_UPDATE_MIME_INFO_THREAD_H + +#include "MimeUpdateThread.h" + +namespace BPrivate { +namespace Storage { +namespace Mime { + +class UpdateMimeInfoThread : public MimeUpdateThread { +public: + UpdateMimeInfoThread(const char *name, int32 priority, + BMessenger managerMessenger, const entry_ref *root, bool recursive, + int32 force, BMessage *replyee); + status_t DoMimeUpdate(const entry_ref *entry, bool *entryIsDir); +}; + +} // namespace Mime +} // namespace Storage +} // namespace BPrivate + +#endif // _MIME_UPDATE_MIME_INFO_THREAD_H Deleted: haiku/trunk/src/servers/registrar/mime/database_access.cpp Deleted: haiku/trunk/src/servers/registrar/mime/database_support.cpp From mmlr at mail.berlios.de Sat Jan 12 00:12:42 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 12 Jan 2008 00:12:42 +0100 Subject: [Haiku-commits] r23424 - haiku/trunk/src/kits/interface Message-ID: <200801112312.m0BNCgHX000132@sheep.berlios.de> Author: mmlr Date: 2008-01-12 00:12:41 +0100 (Sat, 12 Jan 2008) New Revision: 23424 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23424&view=rev Modified: haiku/trunk/src/kits/interface/View.cpp Log: Add a temporary backwards compatibility fix for applications that accidently mix up the resizingMode and flags field in the BView constructor. This does not cause problems under BeOS but was causing wrong follow modes when those applications were run under Haiku. In case such an application is detetected a corresponding warning is printed out. Also added a comment explaining the rational behind the change and a ToDo for the later cleanup. Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2008-01-11 22:45:06 UTC (rev 23423) +++ haiku/trunk/src/kits/interface/View.cpp 2008-01-11 23:12:41 UTC (rev 23424) @@ -4193,9 +4193,19 @@ STRACE(("BView::InitData: enter\n")); - // initialize members - fFlags = (resizingMode & _RESIZE_MASK_) | (flags & ~_RESIZE_MASK_); + // initialize members + if ((resizingMode & ~_RESIZE_MASK_) || (flags & _RESIZE_MASK_)) + printf("BView::InitData(): resizing mode or flags swapped\n"); + // There are applications that swap the resize mask and the flags in the + // BView constructor. This does not cause problems under BeOS as it just + // ors the two fields to one 32bit flag. + // For now we do the same but print the above warning message. + // ToDo: this should be removed at some point and the original + // version restored: + // fFlags = (resizingMode & _RESIZE_MASK_) | (flags & ~_RESIZE_MASK_); + fFlags = resizingMode | flags; + // handle rounding frame.left = roundf(frame.left); frame.top = roundf(frame.top); From marcusoverhagen at mail.berlios.de Sat Jan 12 00:13:28 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 12 Jan 2008 00:13:28 +0100 Subject: [Haiku-commits] r23425 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801112313.m0BNDSnn000181@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-12 00:13:27 +0100 (Sat, 12 Jan 2008) New Revision: 23425 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23425&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h haiku/trunk/src/add-ons/kernel/bus_managers/ata/pio.c Log: Implemented PIO transfers again. Haiku starts in vmware now with this stack. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-11 23:12:41 UTC (rev 23424) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-11 23:13:27 UTC (rev 23425) @@ -18,6 +18,11 @@ #define TRACE dprintf #define FLOW dprintf + +static void ata_exec_dma_transfer(ata_request *request); +static void ata_exec_pio_transfer(ata_request *request); + + void ata_select_device(ide_bus_info *bus, int device) { @@ -29,16 +34,10 @@ tf.chs.mode = ide_mode_lba; tf.chs.device = device ? 1 : 0; -// if (ata_wait_idle(bus) != B_OK) -// FLOW("ata_select_device step 1 bus not idle\n"); - bus->controller->write_command_block_regs(bus->channel_cookie, &tf, ide_mask_device_head); bus->controller->get_altstatus(bus->channel_cookie); // flush posted writes spin(1); // wait 400 nsec -// if (ata_wait_idle(bus) != B_OK) -// FLOW("ata_select_device step 2 bus not idle\n"); - // for debugging only bus->controller->read_command_block_regs(bus->channel_cookie, &tf, ide_mask_device_head); if (tf.chs.device != device) @@ -756,7 +755,7 @@ void ata_exec_read_write(ide_device_info *device, ata_request *request, - uint64 pos, size_t length, bool write) + uint64 address, size_t sectorCount, bool write) { ide_bus_info *bus = device->bus; ata_flags flags = 0; @@ -769,19 +768,18 @@ if (request->uses_dma) { if (!prepare_dma(device, request)) { // fall back to PIO on error - request->uses_dma = false; } } if (!request->uses_dma) { prep_PIO_transfer(device, request); - device->left_blocks = length; + device->left_blocks = sectorCount; } // compose command - if (!create_rw_taskfile(device, request, pos, length, write)) - goto err_setup; + if (!create_rw_taskfile(device, request, address, sectorCount, write)) + goto error; // if no timeout is specified, use standard timeout = request->ccb->timeout > 0 ? request->ccb->timeout * 1000 : IDE_STD_TIMEOUT; @@ -791,42 +789,80 @@ if (request->uses_dma) flags |= ATA_DMA_TRANSFER; if (ata_send_command(device, request, flags, timeout) != B_OK) - goto err_send; + goto error; + // this could be executed in a DPC to improve performance if (request->uses_dma) { - - start_dma_wait_no_lock(device, request); + ata_exec_dma_transfer(request); } else { - // on PIO read, we start with waiting, on PIO write we can - // transmit data immediately; we let the service thread do - // the writing, so the caller can issue the next command - // immediately (this optimisation really pays on SMP systems - // only) - SHOW_FLOW0(3, "Ready for PIO"); - if (request->is_write) { - SHOW_FLOW0(3, "Scheduling write DPC"); - scsi->schedule_dpc(bus->scsi_cookie, bus->irq_dpc, ide_dpc, bus); - } + ata_exec_pio_transfer(request); } - return; -err_setup: - // error during setup +error: if (request->uses_dma) abort_dma(device, request); + ata_request_finish(request, false); +} - ata_request_finish(request, false); + +static void +ata_exec_dma_transfer(ata_request *request) +{ + ASSERT(0); +} + +static void +ata_exec_pio_transfer(ata_request *request) +{ + ide_device_info *device = request->device; + ide_bus_info *bus = device->bus; + uint32 timeout = request->ccb->timeout > 0 ? + request->ccb->timeout * 1000 : IDE_STD_TIMEOUT; + +// FLOW("ata_exec_pio_transfer\n"); + + FLOW("ata_exec_pio_transfer: length %d, left_sg_elem %d, cur_sg_elem %d, cur_sg_ofs %d\n", + request->ccb->data_length, device->left_sg_elem, device->cur_sg_elem, device->cur_sg_ofs); + + if (ata_wait(bus, ide_status_drq, ide_status_bsy, 0, 4000000) != B_OK) { + TRACE("ata_exec_pio_transfer: wait failed\n"); + goto error; + } + + while (device->left_blocks > 0) { + if (request->is_write) { + FLOW("writing 1 block\n"); + if (write_PIO_block(request, 512) != B_OK) + goto transfer_error; + } else { + FLOW("reading 1 block\n"); + if (read_PIO_block(request, 512) != B_OK) + goto transfer_error; + } + device->left_blocks--; + FLOW("%d blocks left\n", device->left_blocks); + } + + if (ata_wait_for_drqdown(bus) != B_OK) { + TRACE("ata_exec_pio_transfer: ata_wait_for_drqdown failed\n"); + goto error; + } + + ata_finish_command(device, &request, ATA_WAIT_FINISH | ATA_DRDY_REQUIRED, ide_error_abrt); + ata_request_finish(request, false /* resubmit */); return; - -err_send: - // error during/after send; - // in this case, the device discards queued ccb automatically - if (request->uses_dma) - abort_dma(device, request); -// finish_reset_queue(request); - ata_request_finish(request, false); +error: + TRACE("ata_exec_pio_transfer: error\n"); + ata_request_set_status(request, SCSI_SEQUENCE_FAIL); + ata_request_finish(request, false /* resubmit */); + return; + +transfer_error: + TRACE("ata_exec_pio_transfer: transfer error\n"); + ata_request_set_status(request, SCSI_SEQUENCE_FAIL); + ata_request_finish(request, false /* resubmit */); } @@ -1079,7 +1115,7 @@ return B_ERROR; } - if (ata_wait(bus, ide_status_drq, ide_status_bsy, ATA_CHECK_ERROR_BIT, 4000000) != B_OK) { + if (ata_wait(bus, ide_status_drq, ide_status_bsy, 0, 4000000) != B_OK) { TRACE("ata_identify_device: wait failed\n"); return B_ERROR; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-11 23:12:41 UTC (rev 23424) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-11 23:13:27 UTC (rev 23425) @@ -139,7 +139,7 @@ } IDE_LOCK(request->device->bus); - ASSERT(request->device->bus->state == ata_state_busy); + ASSERT(request->device->bus->state != ata_state_idle); ASSERT(request->device->bus->active_device == request->device); ASSERT(request->device->requestActive == request); ASSERT(request->device->requestFree == NULL); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-11 23:12:41 UTC (rev 23424) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_internal.h 2008-01-11 23:13:27 UTC (rev 23425) @@ -208,7 +208,7 @@ bool check_rw_error(ide_device_info *device, ata_request *request); bool check_output(ide_device_info *device, bool drdy_required, int error_mask, bool is_write); -void ata_exec_read_write(ide_device_info *device, ata_request *request, uint64 pos, size_t length, bool write); +void ata_exec_read_write(ide_device_info *device, ata_request *request, uint64 address, size_t sectorCount, bool write); void ata_dpc_DMA(ata_request *request); void ata_dpc_PIO(ata_request *request); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/pio.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/pio.c 2008-01-11 23:12:41 UTC (rev 23424) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/pio.c 2008-01-11 23:13:27 UTC (rev 23425) @@ -43,6 +43,7 @@ #include +#define FLOW dprintf // internal error code if scatter gather table is too short #define ERR_TOO_BIG (B_ERRORS_END + 1) @@ -157,6 +158,8 @@ return B_ERROR; } + ASSERT((physicalAddress & 4097) == (virtualAddress & 4097)); + // if chunks starts in the middle of a page, we have even less then // a page left page_left = B_PAGE_SIZE - physicalAddress % B_PAGE_SIZE; @@ -184,7 +187,7 @@ /*! Transfer PIO block from/to buffer */ -static inline int +static inline status_t transfer_PIO_block(ide_device_info *device, int length, bool write, int *transferred) { // data is usually split up into multiple scatter/gather blocks @@ -230,11 +233,9 @@ static void write_discard_PIO(ide_device_info *device, int length) { + static const uint8 buffer[32] = {}; ide_bus_info *bus = device->bus; - uint8 buffer[32]; - memset(buffer, 0, sizeof(buffer)); - // we transmit 32 zero-bytes at once // (not very efficient but easy to implement - you get what you deserve // when you don't provide enough buffer) From mmu_man at mail.berlios.de Sat Jan 12 00:49:43 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 12 Jan 2008 00:49:43 +0100 Subject: [Haiku-commits] r23426 - haiku/trunk/3rdparty/mmu_man/themes Message-ID: <200801112349.m0BNnhkq004632@sheep.berlios.de> Author: mmu_man Date: 2008-01-12 00:49:42 +0100 (Sat, 12 Jan 2008) New Revision: 23426 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23426&view=rev Modified: haiku/trunk/3rdparty/mmu_man/themes/CompareMessages.cpp haiku/trunk/3rdparty/mmu_man/themes/DumpMessage.cpp haiku/trunk/3rdparty/mmu_man/themes/FileUtils.cpp haiku/trunk/3rdparty/mmu_man/themes/ParseMessage.cpp haiku/trunk/3rdparty/mmu_man/themes/ThemeAddonItem.cpp haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp Log: First pass at building for Haiku. Modified: haiku/trunk/3rdparty/mmu_man/themes/CompareMessages.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/CompareMessages.cpp 2008-01-11 23:13:27 UTC (rev 23425) +++ haiku/trunk/3rdparty/mmu_man/themes/CompareMessages.cpp 2008-01-11 23:49:42 UTC (rev 23426) @@ -8,16 +8,15 @@ /* returns true if == */ bool CompareMessages(BMessage &a, BMessage &b) { - void *cookie = NULL; - const char *name; + char *name; type_code code; - int32 count, i; + int32 count, index, i; const void *adata, *bdata; ssize_t asize, bsize; if (a.what != b.what) return false; - while (a.GetNextName(&cookie, &name, &code, &count) == B_OK) { + for (index = 0; a.GetInfo(B_ANY_TYPE, index, &name, &code, &count) == B_OK; i++) { for (i = 0; i < count; i++) { if (a.FindData(name, code, i, &adata, &asize) != B_OK) return false; @@ -29,9 +28,8 @@ return false; } } - cookie = NULL; /* cross compare */ - while (b.GetNextName(&cookie, &name, &code, &count) == B_OK) { + for (index = 0; b.GetInfo(B_ANY_TYPE, index, &name, &code, &count) == B_OK; i++) { type_code acode; int32 acount; if (a.GetInfo(name, &acode, &acount) < B_OK) Modified: haiku/trunk/3rdparty/mmu_man/themes/DumpMessage.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/DumpMessage.cpp 2008-01-11 23:13:27 UTC (rev 23425) +++ haiku/trunk/3rdparty/mmu_man/themes/DumpMessage.cpp 2008-01-11 23:49:42 UTC (rev 23426) @@ -58,9 +58,8 @@ status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, BMessage *names) { - int32 index; - void *cookie = NULL; - const char *field_name; + int32 field, index; + char *field_name; type_code field_code; int32 field_count; char buffer[80]; @@ -93,10 +92,10 @@ // stream.Write(tabs+2, tabCount-2); stream.Write(buffer, strlen(buffer)); - while (message->GetNextName(&cookie, + for (field = 0; message->GetInfo(B_ANY_TYPE, field, &field_name, &field_code, - &field_count) == B_OK) { + &field_count) == B_OK; field++) { if (LookUpFieldName(&easy_name, field_name, names)) { stream.Write(tabs+1, tabCount); stream.Write("// ", 3); @@ -121,6 +120,7 @@ DumpMessageToStream(&m, stream, tabCount, names); } break; +#ifdef B_BEOS_VERSION_DANO case 'FONt': { BFont f; @@ -140,6 +140,54 @@ stream.Write("\n", 1); } break; +#else + case 'FONt': + { + BFont f; + const void *data; + ssize_t len; + if (message->FindData(field_name, index, &data, &len) >= B_OK) { + if (len <= (ssize_t)sizeof(f)) { + // Hack: only Dano has BFont : public BFlattenable + memcpy((void *)&f, data, len); + //stream << f; + font_family family; + font_style style; + font_height height; + f.GetFamilyAndStyle(&family, &style); + f.GetHeight(&height); + BString s; + s << "BFont(" << family; + s << "/" << style << "/" << f.Size(); + s << ", shear=" << f.Shear(); + s << ", rot=" << f.Rotation(); + s << ", height=" << height.ascent; + s << "+" << height.descent; + s << "+" << height.leading << ")"; + stream.Write(s.String(), s.Length()); + } // else too big + } + stream.Write("\n", 1); + } + break; + case B_RGB_COLOR_TYPE: + { + rgb_color c; + const void *data; + ssize_t len; + if (message->FindData(field_name, index, &data, &len) >= B_OK) { + if (len <= (ssize_t)sizeof(c)) { + // Hack + memcpy((void *)&c, data, len); + sprintf(buffer, "rgb_color(%d,%d,%d,%d)", + c.red, c.green, c.blue, c.alpha); + stream.Write(buffer, strlen(buffer)); + } // else too big + } + stream.Write("\n", 1); + } + break; +#endif case B_BOOL_TYPE: { bool value; Modified: haiku/trunk/3rdparty/mmu_man/themes/FileUtils.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/FileUtils.cpp 2008-01-11 23:13:27 UTC (rev 23425) +++ haiku/trunk/3rdparty/mmu_man/themes/FileUtils.cpp 2008-01-11 23:49:42 UTC (rev 23426) @@ -165,7 +165,7 @@ status_t unescape_find_directory(BString *dir) { - status_t err; + status_t err = B_ERROR; int32 s, e; BString tok; BPath path; @@ -180,7 +180,9 @@ _BORK(B_DESKTOP_DIRECTORY); _BORK(B_TRASH_DIRECTORY); +#ifdef B_BEOS_VERSION_DANO _BORK(B_ROOT_DIRECTORY); +#endif _BORK(B_BEOS_DIRECTORY); _BORK(B_BEOS_SYSTEM_DIRECTORY); Modified: haiku/trunk/3rdparty/mmu_man/themes/ParseMessage.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ParseMessage.cpp 2008-01-11 23:13:27 UTC (rev 23425) +++ haiku/trunk/3rdparty/mmu_man/themes/ParseMessage.cpp 2008-01-11 23:49:42 UTC (rev 23426) @@ -5,6 +5,8 @@ #include #include #include +#include + #include "DumpMessage.h" #define MAX_TEXT_LINE_INPUT_SIZE 4096 @@ -192,7 +194,7 @@ if (!has_alpha) v.alpha = 255; //msg->AddRGBColor(name, v); - msg->AddData(name, (type_code)'RGBC', &v, 4); + msg->AddData(name, B_RGB_COLOR_TYPE, &v, 4); return B_OK; } @@ -255,7 +257,11 @@ f.SetFamilyAndStyle(ff, fs); f.SetSize(size); //f.PrintToStream(); +#ifdef B_BEOS_VERSION_DANO msg->AddFlat(name, &f); +#else + msg->AddData(name, 'FONt', (void *)&f, sizeof(f)); +#endif return B_OK; } Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemeAddonItem.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemeAddonItem.cpp 2008-01-11 23:13:27 UTC (rev 23425) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemeAddonItem.cpp 2008-01-11 23:49:42 UTC (rev 23426) @@ -2,10 +2,20 @@ #include "ThemeInterfaceView.h" #include "ThemeManager.h" #include "UITheme.h" +#include +#ifdef B_ZETA_VERSION #include +#else +#define _T(v) v +#define B_LANGUAGE_CHANGED '_BLC' +#define B_PREF_APP_SET_DEFAULTS 'zPAD' +#define B_PREF_APP_REVERT 'zPAR' +#define B_PREF_APP_ADDON_REF 'zPAA' +#endif #include #include #include +#include #include #include @@ -24,10 +34,16 @@ tman = iview->GetThemeManager(); fAddonName = tman->AddonName(id); BString tip(tman->AddonDescription(id)); +#ifdef B_BEOS_VERSION_DANO SetToolTipText(tip.String()); SetViewUIColor(B_UI_PANEL_BACKGROUND_COLOR); SetLowUIColor(B_UI_PANEL_BACKGROUND_COLOR); SetHighUIColor(B_UI_PANEL_TEXT_COLOR); +#else + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); +#endif BMessage *apply = new BMessage(CB_APPLY); apply->AddInt32("addon", id); BMessage *save = new BMessage(CB_SAVE); @@ -35,15 +51,19 @@ BMessage *prefs = new BMessage(BTN_PREFS); prefs->AddInt32("addon", id); fApplyBox = new BCheckBox(BRect(CTRL_OFF_X, CTRL_OFF_Y, CTRL_OFF_X+50, CTRL_OFF_Y+30), "apply", _T("Apply"), apply); - fApplyBox->SetToolTipText(_T("Use this information from themes")); fApplyBox->SetValue((tman->AddonFlags(id) & Z_THEME_ADDON_DO_SET_ALL)?B_CONTROL_ON:B_CONTROL_OFF); fSaveBox = new BCheckBox(BRect(CTRL_OFF_X+50+CTRL_SPACING, CTRL_OFF_Y, CTRL_OFF_X+100+CTRL_SPACING, CTRL_OFF_Y+30), "save", _T("Save"), save); + fSaveBox->SetValue((tman->AddonFlags(id) & Z_THEME_ADDON_DO_RETRIEVE)?B_CONTROL_ON:B_CONTROL_OFF); +#ifdef B_BEOS_VERSION_DANO + fApplyBox->SetToolTipText(_T("Use this information from themes")); fSaveBox->SetToolTipText(_T("Save this information to themes")); - fSaveBox->SetValue((tman->AddonFlags(id) & Z_THEME_ADDON_DO_RETRIEVE)?B_CONTROL_ON:B_CONTROL_OFF); +#endif #ifdef HAVE_PREF_BTN fPrefsBtn = new BButton(BRect(CTRL_OFF_X+100+CTRL_SPACING*2, CTRL_OFF_Y, CTRL_OFF_X+150+CTRL_SPACING*2, CTRL_OFF_Y+30), "prefs", _T("Preferences"), prefs); +#ifdef B_BEOS_VERSION_DANO fPrefsBtn->SetToolTipText(_T("Run the preferences panel for this topic.")); #endif +#endif BFont fnt; GetFont(&fnt); fnt.SetSize(fnt.Size()+1); @@ -95,13 +115,17 @@ void ThemeAddonItem::RelocalizeStrings() { fApplyBox->SetLabel(_T("Apply")); + fSaveBox->SetLabel(_T("Save")); +#ifdef B_BEOS_VERSION_DANO fApplyBox->SetToolTipText(_T("Use this information from themes")); - fSaveBox->SetLabel(_T("Save")); fSaveBox->SetToolTipText(_T("Save this information to themes")); +#endif #ifdef HAVE_PREF_BTN fPrefsBtn->SetLabel(_T("Preferences")); +#ifdef B_BEOS_VERSION_DANO fPrefsBtn->SetToolTipText(_T("Run the preferences panel for this topic.")); #endif +#endif RelayoutButtons(); } Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp 2008-01-11 23:13:27 UTC (rev 23425) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp 2008-01-11 23:49:42 UTC (rev 23426) @@ -1,16 +1,25 @@ -#include #include #include #include #include #include #include +#include +#ifdef B_ZETA_VERSION +#include #include +#include +#else +#define _T(v) v +#define B_PREF_APP_ENABLE_REVERT 'zPAE' +#define B_PREF_APP_SET_DEFAULTS 'zPAD' +#define B_PREF_APP_REVERT 'zPAR' +#define B_PREF_APP_ADDON_REF 'zPAA' +#endif #include -#include #include #include -#include +#include #include #include @@ -21,6 +30,8 @@ #include #include +#include + #include "UITheme.h" #include "TextInputAlert.h" @@ -103,7 +114,11 @@ BView::AllAttached(); fPopupInvoker = new BInvoker(new BMessage(kReallyCreateTheme), this); +#ifdef B_BEOS_VERSION_DANO SetViewUIColor(B_UI_PANEL_BACKGROUND_COLOR); +#else + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); +#endif fThemeManager = new ThemeManager; fThemeManager->LoadThemes(); From stippi at mail.berlios.de Sat Jan 12 01:27:08 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 12 Jan 2008 01:27:08 +0100 Subject: [Haiku-commits] r23427 - haiku/trunk/src/apps/showimage Message-ID: <200801120027.m0C0R80G024771@sheep.berlios.de> Author: stippi Date: 2008-01-12 01:27:08 +0100 (Sat, 12 Jan 2008) New Revision: 23427 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23427&view=rev Modified: haiku/trunk/src/apps/showimage/ShowImageView.cpp Log: patch by Andrea Anzani: * fix a rounding problem when layouting the image Thanks! Modified: haiku/trunk/src/apps/showimage/ShowImageView.cpp =================================================================== --- haiku/trunk/src/apps/showimage/ShowImageView.cpp 2008-01-11 23:49:42 UTC (rev 23426) +++ haiku/trunk/src/apps/showimage/ShowImageView.cpp 2008-01-12 00:27:08 UTC (rev 23427) @@ -793,10 +793,10 @@ // always align in the center if (width > bitmapWidth) - rect.OffsetBy((width - bitmapWidth) / 2.0, 0); + rect.OffsetBy(floorf((width - bitmapWidth) / 2.0), 0); if (height > bitmapHeight) - rect.OffsetBy(0, (height - bitmapHeight) / 2.0); + rect.OffsetBy(0, floorf((height - bitmapHeight) / 2.0)); } rect.OffsetBy(PEN_SIZE, PEN_SIZE); return rect; From marcusoverhagen at mail.berlios.de Sat Jan 12 01:52:58 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 12 Jan 2008 01:52:58 +0100 Subject: [Haiku-commits] r23428 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801120052.m0C0qw34026180@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-12 01:52:57 +0100 (Sat, 12 Jan 2008) New Revision: 23428 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23428&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c Log: removed/disabled some debug output Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-12 00:27:08 UTC (rev 23427) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-12 00:52:57 UTC (rev 23428) @@ -102,7 +102,6 @@ return B_ERROR; if ((status & set) == set && (status & cleared) == 0) { - dprintf("ata_wait: set %x, cleared %x, elapsed time %lld\n", set, cleared, elapsedTime); return B_OK; } @@ -111,10 +110,10 @@ if (elapsedTime > timeout) return B_TIMED_OUT; - if (elapsedTime < 150000) + if (elapsedTime < 4000) spin(1); else - snooze(3000); + snooze(4000); } } @@ -167,7 +166,7 @@ ide_bus_info *bus = device->bus; ASSERT((device->tf_param_mask & ide_mask_command) == 0); - ASSERT(bus->state == ata_state_busy); +// ASSERT(bus->state == ata_state_busy); // XXX fix this ASSERT((flags & ATA_DMA_TRANSFER) == 0); // XXX only pio for now @@ -205,7 +204,7 @@ if (bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, device->tf_param_mask) != B_OK) goto err; - FLOW("Writing command 0x%02x\n", (int)device->tf.write.command); +// FLOW("Writing command 0x%02x\n", (int)device->tf.write.command); IDE_LOCK(bus); @@ -219,7 +218,7 @@ if (bus->controller->write_command_block_regs(bus->channel_cookie, &device->tf, ide_mask_command) != B_OK) goto err_clearint; - ASSERT(bus->state == ata_state_busy); +// ASSERT(bus->state == ata_state_busy); XXX fix this bus->state = (flags & ATA_DMA_TRANSFER) ? ata_state_dma : ata_state_pio; request->timeout = timeout; @@ -820,11 +819,9 @@ uint32 timeout = request->ccb->timeout > 0 ? request->ccb->timeout * 1000 : IDE_STD_TIMEOUT; -// FLOW("ata_exec_pio_transfer\n"); +// FLOW("ata_exec_pio_transfer: length %d, left_sg_elem %d, cur_sg_elem %d, cur_sg_ofs %d\n", +// request->ccb->data_length, device->left_sg_elem, device->cur_sg_elem, device->cur_sg_ofs); - FLOW("ata_exec_pio_transfer: length %d, left_sg_elem %d, cur_sg_elem %d, cur_sg_ofs %d\n", - request->ccb->data_length, device->left_sg_elem, device->cur_sg_elem, device->cur_sg_ofs); - if (ata_wait(bus, ide_status_drq, ide_status_bsy, 0, 4000000) != B_OK) { TRACE("ata_exec_pio_transfer: wait failed\n"); goto error; @@ -832,16 +829,16 @@ while (device->left_blocks > 0) { if (request->is_write) { - FLOW("writing 1 block\n"); +// FLOW("writing 1 block\n"); if (write_PIO_block(request, 512) != B_OK) goto transfer_error; } else { - FLOW("reading 1 block\n"); +// FLOW("reading 1 block\n"); if (read_PIO_block(request, 512) != B_OK) goto transfer_error; } device->left_blocks--; - FLOW("%d blocks left\n", device->left_blocks); +// FLOW("%d blocks left\n", device->left_blocks); } if (ata_wait_for_drqdown(bus) != B_OK) { Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-12 00:27:08 UTC (rev 23427) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ide_sim.c 2008-01-12 00:52:57 UTC (rev 23428) @@ -69,12 +69,12 @@ ata_request_start(&request, device, ccb); if (request) { - TRACE("calling exec_io: %p, %d:%d\n", bus, ccb->target_id, ccb->target_lun); + FLOW("calling exec_io: %p, %d:%d\n", bus, ccb->target_id, ccb->target_lun); device->exec_io(device, request); return; } - TRACE("Bus busy\n"); + TRACE("Bus busy %d:%d\n", ccb->target_id, ccb->target_lun); ACQUIRE_BEN(&bus->status_report_ben); scsi->requeue(ccb, true); RELEASE_BEN(&bus->status_report_ben); @@ -82,7 +82,6 @@ err_inv_device: - FLOW("Invalid device %d:%d\n", ccb->target_id, ccb->target_lun); ccb->subsys_status = SCSI_SEL_TIMEOUT; ACQUIRE_BEN(&bus->status_report_ben); @@ -92,8 +91,7 @@ err_disconnected: - - TRACE("No controller anymore\n"); + TRACE("No controller anymore %d:%d\n", ccb->target_id, ccb->target_lun); ccb->subsys_status = SCSI_NO_HBA; ACQUIRE_BEN(&bus->status_report_ben); scsi->finished(ccb, 1); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-12 00:27:08 UTC (rev 23427) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-12 00:52:57 UTC (rev 23428) @@ -421,7 +421,7 @@ { scsi_ccb *ccb = request->ccb; - FLOW("ata_exec_io: scsi command 0x%02x\n", ccb->cdb[0]); + //FLOW("ata_exec_io: scsi command 0x%02x\n", ccb->cdb[0]); // ATA devices have one LUN only if (ccb->target_lun != 0) { @@ -532,7 +532,7 @@ | (uint32)cmd->low_lba; length = cmd->length != 0 ? cmd->length : 256; - FLOW("READ6/WRITE6 pos=%lx, length=%lx\n", pos, length); + //FLOW("READ6/WRITE6 pos=%lx, length=%lx\n", pos, length); ata_exec_read_write(device, request, pos, length, cmd->opcode == SCSI_OP_WRITE_6); return; @@ -548,7 +548,7 @@ pos = B_BENDIAN_TO_HOST_INT32(cmd->lba); length = B_BENDIAN_TO_HOST_INT16(cmd->length); - FLOW("READ10/WRITE10 pos=%lx, length=%lx\n", pos, length); + //FLOW("READ10/WRITE10 pos=%lx, length=%lx\n", pos, length); if (length != 0) { ata_exec_read_write(device, request, pos, length, cmd->opcode == SCSI_OP_WRITE_10); From mmu_man at mail.berlios.de Sat Jan 12 02:05:40 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 12 Jan 2008 02:05:40 +0100 Subject: [Haiku-commits] r23429 - in haiku/trunk/3rdparty/mmu_man/themes: . addons Message-ID: <200801120105.m0C15ett026908@sheep.berlios.de> Author: mmu_man Date: 2008-01-12 02:05:37 +0100 (Sat, 12 Jan 2008) New Revision: 23429 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23429&view=rev Added: haiku/trunk/3rdparty/mmu_man/themes/Utils.cpp haiku/trunk/3rdparty/mmu_man/themes/Utils.h haiku/trunk/3rdparty/mmu_man/themes/addons/DanoUISettingsAddon.cpp Removed: haiku/trunk/3rdparty/mmu_man/themes/FileUtils.cpp haiku/trunk/3rdparty/mmu_man/themes/FileUtils.h haiku/trunk/3rdparty/mmu_man/themes/addons/UISettingsAddon.cpp Modified: haiku/trunk/3rdparty/mmu_man/themes/CompareMessages.cpp haiku/trunk/3rdparty/mmu_man/themes/DumpMessage.cpp haiku/trunk/3rdparty/mmu_man/themes/Jamfile haiku/trunk/3rdparty/mmu_man/themes/ParseMessage.cpp haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp haiku/trunk/3rdparty/mmu_man/themes/UITheme.h haiku/trunk/3rdparty/mmu_man/themes/addons/BackgroundsAddon.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/BeIDEAddon.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/DanoWindowDecorAddon.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/EddieAddon.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/PeAddon.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/ScreensaverAddon.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/SoundplayColorAddon.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/SoundsAddon.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp Log: It compiles for Haiku now, but doesn't link yet. Modified: haiku/trunk/3rdparty/mmu_man/themes/CompareMessages.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/CompareMessages.cpp 2008-01-12 00:52:57 UTC (rev 23428) +++ haiku/trunk/3rdparty/mmu_man/themes/CompareMessages.cpp 2008-01-12 01:05:37 UTC (rev 23429) @@ -4,6 +4,7 @@ #include #include +#include "Utils.h" /* returns true if == */ bool CompareMessages(BMessage &a, BMessage &b) @@ -16,7 +17,7 @@ if (a.what != b.what) return false; - for (index = 0; a.GetInfo(B_ANY_TYPE, index, &name, &code, &count) == B_OK; i++) { + for (index = 0; a.GetInfo(B_ANY_TYPE, index, GET_INFO_NAME_PTR(&name), &code, &count) == B_OK; i++) { for (i = 0; i < count; i++) { if (a.FindData(name, code, i, &adata, &asize) != B_OK) return false; @@ -29,7 +30,7 @@ } } /* cross compare */ - for (index = 0; b.GetInfo(B_ANY_TYPE, index, &name, &code, &count) == B_OK; i++) { + for (index = 0; b.GetInfo(B_ANY_TYPE, index, GET_INFO_NAME_PTR(&name), &code, &count) == B_OK; i++) { type_code acode; int32 acount; if (a.GetInfo(name, &acode, &acount) < B_OK) Modified: haiku/trunk/3rdparty/mmu_man/themes/DumpMessage.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/DumpMessage.cpp 2008-01-12 00:52:57 UTC (rev 23428) +++ haiku/trunk/3rdparty/mmu_man/themes/DumpMessage.cpp 2008-01-12 01:05:37 UTC (rev 23429) @@ -4,7 +4,9 @@ #include #include #include + #include "DumpMessage.h" +#include "Utils.h" //#define WHAT_ALWAYS_HEX 1 @@ -93,7 +95,7 @@ stream.Write(buffer, strlen(buffer)); for (field = 0; message->GetInfo(B_ANY_TYPE, field, - &field_name, + GET_INFO_NAME_PTR(&field_name), &field_code, &field_count) == B_OK; field++) { if (LookUpFieldName(&easy_name, field_name, names)) { @@ -120,19 +122,10 @@ DumpMessageToStream(&m, stream, tabCount, names); } break; -#ifdef B_BEOS_VERSION_DANO - case 'FONt': - { - BFont f; - if (message->FindFlat(field_name, index, &f) >= B_OK) - stream << f; - stream.Write("\n", 1); - } - break; case B_RGB_COLOR_TYPE: { rgb_color c; - if (message->FindRGBColor(field_name, index, &c) >= B_OK) { + if (FindRGBColor(*message, field_name, index, &c) >= B_OK) { sprintf(buffer, "rgb_color(%d,%d,%d,%d)", c.red, c.green, c.blue, c.alpha); stream.Write(buffer, strlen(buffer)); @@ -140,54 +133,32 @@ stream.Write("\n", 1); } break; -#else case 'FONt': { BFont f; - const void *data; - ssize_t len; - if (message->FindData(field_name, index, &data, &len) >= B_OK) { - if (len <= (ssize_t)sizeof(f)) { - // Hack: only Dano has BFont : public BFlattenable - memcpy((void *)&f, data, len); - //stream << f; - font_family family; - font_style style; - font_height height; - f.GetFamilyAndStyle(&family, &style); - f.GetHeight(&height); - BString s; - s << "BFont(" << family; - s << "/" << style << "/" << f.Size(); - s << ", shear=" << f.Shear(); - s << ", rot=" << f.Rotation(); - s << ", height=" << height.ascent; - s << "+" << height.descent; - s << "+" << height.leading << ")"; - stream.Write(s.String(), s.Length()); - } // else too big + if (FindFont(*message, field_name, index, &f) >= B_OK) { +#ifdef B_BEOS_VERSION_DANO + stream << f; +#else + font_family family; + font_style style; + font_height height; + f.GetFamilyAndStyle(&family, &style); + f.GetHeight(&height); + BString s; + s << "BFont(" << family; + s << "/" << style << "/" << f.Size(); + s << ", shear=" << f.Shear(); + s << ", rot=" << f.Rotation(); + s << ", height=" << height.ascent; + s << "+" << height.descent; + s << "+" << height.leading << ")"; + stream.Write(s.String(), s.Length()); +#endif } stream.Write("\n", 1); } break; - case B_RGB_COLOR_TYPE: - { - rgb_color c; - const void *data; - ssize_t len; - if (message->FindData(field_name, index, &data, &len) >= B_OK) { - if (len <= (ssize_t)sizeof(c)) { - // Hack - memcpy((void *)&c, data, len); - sprintf(buffer, "rgb_color(%d,%d,%d,%d)", - c.red, c.green, c.blue, c.alpha); - stream.Write(buffer, strlen(buffer)); - } // else too big - } - stream.Write("\n", 1); - } - break; -#endif case B_BOOL_TYPE: { bool value; Deleted: haiku/trunk/3rdparty/mmu_man/themes/FileUtils.cpp Deleted: haiku/trunk/3rdparty/mmu_man/themes/FileUtils.h Modified: haiku/trunk/3rdparty/mmu_man/themes/Jamfile =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/Jamfile 2008-01-12 00:52:57 UTC (rev 23428) +++ haiku/trunk/3rdparty/mmu_man/themes/Jamfile 2008-01-12 01:05:37 UTC (rev 23429) @@ -10,22 +10,22 @@ addonSources = BackgroundsAddon.cpp BeIDEAddon.cpp + DanoUISettingsAddon.cpp DanoWindowDecorAddon.cpp DeskbarAddon.cpp EddieAddon.cpp + HaikuUISettingsAddon.cpp PeAddon.cpp ScreensaverAddon.cpp SoundplayColorAddon.cpp SoundsAddon.cpp TerminalAddon.cpp - UISettingsAddon.cpp WinampSkinAddon.cpp ; Application <3rdparty>Themes : CompareMessages.cpp DumpMessage.cpp - FileUtils.cpp MakeScreenshot.cpp ParseMessage.cpp TextInputAlert.cpp @@ -35,6 +35,7 @@ ThemeItem.cpp ThemeManager.cpp ThemesAddon.cpp + Utils.cpp ViewItem.cpp $(addonSources) : be media translation $(TARGET_NETAPI_LIB) $(TARGET_LIBSTDC++) Modified: haiku/trunk/3rdparty/mmu_man/themes/ParseMessage.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ParseMessage.cpp 2008-01-12 00:52:57 UTC (rev 23428) +++ haiku/trunk/3rdparty/mmu_man/themes/ParseMessage.cpp 2008-01-12 01:05:37 UTC (rev 23429) @@ -8,6 +8,7 @@ #include #include "DumpMessage.h" +#include "Utils.h" #define MAX_TEXT_LINE_INPUT_SIZE 4096 @@ -193,8 +194,7 @@ } if (!has_alpha) v.alpha = 255; - //msg->AddRGBColor(name, v); - msg->AddData(name, B_RGB_COLOR_TYPE, &v, 4); + AddRGBColor(*msg, name, v); return B_OK; } @@ -257,11 +257,7 @@ f.SetFamilyAndStyle(ff, fs); f.SetSize(size); //f.PrintToStream(); -#ifdef B_BEOS_VERSION_DANO - msg->AddFlat(name, &f); -#else - msg->AddData(name, 'FONt', (void *)&f, sizeof(f)); -#endif + AddFont(*msg, name, &f); return B_OK; } Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp 2008-01-12 00:52:57 UTC (rev 23428) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp 2008-01-12 01:05:37 UTC (rev 23429) @@ -197,7 +197,11 @@ preview_frame.OffsetTo(10.0, 20.0); fScreenshotPane = new BView(preview_frame, "screenshot", B_FOLLOW_ALL, B_WILL_DRAW); fBox->AddChild(fScreenshotPane); +#ifdef B_BEOS_VERSION_DANO fScreenshotPane->SetViewUIColor(B_UI_PANEL_BACKGROUND_COLOR); +#else + fScreenshotPane->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); +#endif fScreenshotNone = new BStringView(BRect(), "sshotnone", _T("No Theme selected"), (uint32) 0, B_FOLLOW_ALL); fScreenshotNone->SetFontSize(20.0); Modified: haiku/trunk/3rdparty/mmu_man/themes/UITheme.h =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/UITheme.h 2008-01-12 00:52:57 UTC (rev 23428) +++ haiku/trunk/3rdparty/mmu_man/themes/UITheme.h 2008-01-12 01:05:37 UTC (rev 23429) @@ -40,4 +40,31 @@ #define Z_THEMES_FOLDER_NAME "UIThemes" #define Z_THEME_FILE_NAME "Theme" +/* some field names not always defined */ +#ifndef B_BEOS_VERSION_DANO +#define B_UI_PANEL_BACKGROUND_COLOR "be:c:PanBg" +#define B_UI_PANEL_TEXT_COLOR "be:c:PanTx" +#define B_UI_PANEL_LINK_COLOR "be:c:PanLn" +#define B_UI_DOCUMENT_BACKGROUND_COLOR "be:c:DocBg" +#define B_UI_DOCUMENT_TEXT_COLOR "be:c:DocTx" +#define B_UI_DOCUMENT_LINK_COLOR "be:c:DocLn" +#define B_UI_CONTROL_BACKGROUND_COLOR "be:c:CtlBg" +#define B_UI_CONTROL_TEXT_COLOR "be:c:CtlTx" +#define B_UI_CONTROL_BORDER_COLOR "be:c:CtlBr" +#define B_UI_CONTROL_HIGHLIGHT_COLOR "be:c:CtlHg" +#define B_UI_NAVIGATION_BASE_COLOR "be:c:NavBs" +#define B_UI_NAVIGATION_PULSE_COLOR "be:c:NavPl" +#define B_UI_SHINE_COLOR "be:c:Shine" +#define B_UI_SHADOW_COLOR "be:c:Shadow" +#define B_UI_TOOLTIP_BACKGROUND_COLOR "be:c:TipBg" +#define B_UI_TOOLTIP_TEXT_COLOR "be:c:TipTx" +#define B_UI_MENU_BACKGROUND_COLOR "be:c:MenBg" +#define B_UI_MENU_SELECTED_BACKGROUND_COLOR "be:c:MenSBg" +#define B_UI_MENU_ITEM_TEXT_COLOR "be:c:MenTx" +#define B_UI_MENU_SELECTED_ITEM_TEXT_COLOR "be:c:MenSTx" +#define B_UI_MENU_SELECTED_BORDER_COLOR "be:c:MenSBr" +#define B_UI_SUCCESS_COLOR "be:c:Success" +#define B_UI_FAILURE_COLOR "be:c:Failure" +#endif + #endif /* _Z_UI_THEME_H */ Copied: haiku/trunk/3rdparty/mmu_man/themes/Utils.cpp (from rev 23426, haiku/trunk/3rdparty/mmu_man/themes/FileUtils.cpp) =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/FileUtils.cpp 2008-01-11 23:49:42 UTC (rev 23426) +++ haiku/trunk/3rdparty/mmu_man/themes/Utils.cpp 2008-01-12 01:05:37 UTC (rev 23429) @@ -0,0 +1,337 @@ +#include "Utils.h" +#include +#include +#include +#include +#include + + +// some private font information structs +namespace BPrivate { + +typedef struct font_folder_info { + //char name[256]; + char *name; + uint32 flags; +} font_folder_info; +typedef struct font_file_info { + char *name; + uint32 flags; + font_family family; + font_style style; + uint32 dummy; +} font_file_info; + +}; + +using namespace BPrivate; + +// this is PRIVATE to libbe and NOT in R5!!! +extern long _count_font_folders_(void); +extern long _count_font_files_(long); +extern status_t _get_nth_font_file_(long, font_file_info **); +extern status_t _get_nth_font_folder_(long, font_folder_info **); + +status_t find_font_file(entry_ref *to, font_family family, font_style style, float size) +{ + status_t err; + long i, fontcount, foldercount; + font_file_info *ffi; + font_folder_info *fdi; + bool found = false; + (void)size; + + fontcount = _count_font_files_(0); + for (i = 0; i < fontcount; i++) { + err = _get_nth_font_file_(i, &ffi); + if (err) + continue; + if (strcmp(ffi->family, family) || strcmp(ffi->style, style)) + continue; + found = true; + break; + } + if (!found) + return ENOENT; + foldercount = _count_font_folders_(); + for (i = 0; i < fontcount; i++) { + err = _get_nth_font_folder_(i, &fdi); + if (err) + continue; + BPath ffile(fdi->name); + ffile.Append(ffi->name); + printf("find_font_file: looking for '%s' in '%s'\n", ffi->name, fdi->name); + BEntry ent(ffile.Path()); + if (ent.InitCheck()) + continue; + printf("find_font_file: found\n."); + return ent.GetRef(to); + } + return ENOENT; +} + +#define _BORK(_t) \ + err = find_directory(_t, &path); \ + if (!err && (s = dir->FindFirst(path.Path())) >= 0) { \ + printf("found %s\n", #_t); \ + dir->Remove(s, strlen(path.Path()) - s); \ + BString tok(#_t); \ + tok.Prepend("${"); \ + tok.Append("}"); \ + dir->Insert(tok, s); \ + return B_OK; \ + } \ + +status_t escape_find_directory(BString *dir) +{ + status_t err; + BPath path; + int32 s; + + _BORK(B_DESKTOP_DIRECTORY); + _BORK(B_TRASH_DIRECTORY); + //_BORK(B_ROOT_DIRECTORY); + + //_BORK(B_BEOS_BOOT_DIRECTORY); + _BORK(B_BEOS_FONTS_DIRECTORY); + _BORK(B_BEOS_LIB_DIRECTORY); + _BORK(B_BEOS_SERVERS_DIRECTORY); + _BORK(B_BEOS_APPS_DIRECTORY); + _BORK(B_BEOS_BIN_DIRECTORY); + _BORK(B_BEOS_ETC_DIRECTORY); + _BORK(B_BEOS_DOCUMENTATION_DIRECTORY); + _BORK(B_BEOS_PREFERENCES_DIRECTORY); + _BORK(B_BEOS_TRANSLATORS_DIRECTORY); + _BORK(B_BEOS_MEDIA_NODES_DIRECTORY); + _BORK(B_BEOS_SOUNDS_DIRECTORY); + // not in the declared order, so others are picked first + _BORK(B_BEOS_ADDONS_DIRECTORY); + _BORK(B_BEOS_SYSTEM_DIRECTORY); + _BORK(B_BEOS_DIRECTORY); + + _BORK(B_USER_BOOT_DIRECTORY); + _BORK(B_USER_FONTS_DIRECTORY); + _BORK(B_USER_LIB_DIRECTORY); + _BORK(B_USER_SETTINGS_DIRECTORY); + _BORK(B_USER_DESKBAR_DIRECTORY); + _BORK(B_USER_PRINTERS_DIRECTORY); + _BORK(B_USER_TRANSLATORS_DIRECTORY); + _BORK(B_USER_MEDIA_NODES_DIRECTORY); + _BORK(B_USER_SOUNDS_DIRECTORY); + // + _BORK(B_USER_ADDONS_DIRECTORY); + _BORK(B_USER_CONFIG_DIRECTORY); + _BORK(B_USER_DIRECTORY); + + // same for the whole block, prefer user over common + _BORK(B_COMMON_BOOT_DIRECTORY); + _BORK(B_COMMON_FONTS_DIRECTORY); + _BORK(B_COMMON_LIB_DIRECTORY); + _BORK(B_COMMON_SERVERS_DIRECTORY); + _BORK(B_COMMON_BIN_DIRECTORY); + _BORK(B_COMMON_ETC_DIRECTORY); + _BORK(B_COMMON_DOCUMENTATION_DIRECTORY); + _BORK(B_COMMON_SETTINGS_DIRECTORY); + _BORK(B_COMMON_DEVELOP_DIRECTORY); + _BORK(B_COMMON_LOG_DIRECTORY); + _BORK(B_COMMON_SPOOL_DIRECTORY); + _BORK(B_COMMON_TEMP_DIRECTORY); + _BORK(B_COMMON_VAR_DIRECTORY); + _BORK(B_COMMON_TRANSLATORS_DIRECTORY); + _BORK(B_COMMON_MEDIA_NODES_DIRECTORY); + _BORK(B_COMMON_SOUNDS_DIRECTORY); + // + _BORK(B_COMMON_ADDONS_DIRECTORY); + _BORK(B_COMMON_SYSTEM_DIRECTORY); + _BORK(B_COMMON_DIRECTORY); + + _BORK(B_APPS_DIRECTORY); + _BORK(B_PREFERENCES_DIRECTORY); + _BORK(B_UTILITIES_DIRECTORY); + + return B_OK; +} +#undef _BORK + +#define _BORK(_t) \ + if (tok == #_t) { \ + err = find_directory(_t, &path); \ + if (err) return err; \ + dir->Remove(s, e - s + 1); \ + dir->Insert(path.Path(), s); \ + return B_OK; \ + } \ + + +status_t unescape_find_directory(BString *dir) +{ + status_t err = B_ERROR; + int32 s, e; + BString tok; + BPath path; + s = dir->FindFirst("${"); + if (s < 0) + return B_OK; + e = dir->FindFirst("}", s); + if (e < 0) + return B_OK; + dir->CopyInto(tok, s + 2, e - s - 2); + //printf("tok '%s'\n", tok.String()); + + _BORK(B_DESKTOP_DIRECTORY); + _BORK(B_TRASH_DIRECTORY); +#ifdef B_BEOS_VERSION_DANO + _BORK(B_ROOT_DIRECTORY); +#endif + + _BORK(B_BEOS_DIRECTORY); + _BORK(B_BEOS_SYSTEM_DIRECTORY); + _BORK(B_BEOS_ADDONS_DIRECTORY); + _BORK(B_BEOS_BOOT_DIRECTORY); + _BORK(B_BEOS_FONTS_DIRECTORY); + _BORK(B_BEOS_LIB_DIRECTORY); + _BORK(B_BEOS_SERVERS_DIRECTORY); + _BORK(B_BEOS_APPS_DIRECTORY); + _BORK(B_BEOS_BIN_DIRECTORY); + _BORK(B_BEOS_ETC_DIRECTORY); + _BORK(B_BEOS_DOCUMENTATION_DIRECTORY); + _BORK(B_BEOS_PREFERENCES_DIRECTORY); + _BORK(B_BEOS_TRANSLATORS_DIRECTORY); + _BORK(B_BEOS_MEDIA_NODES_DIRECTORY); + _BORK(B_BEOS_SOUNDS_DIRECTORY); + + _BORK(B_COMMON_DIRECTORY); + _BORK(B_COMMON_SYSTEM_DIRECTORY); + _BORK(B_COMMON_ADDONS_DIRECTORY); + _BORK(B_COMMON_BOOT_DIRECTORY); + _BORK(B_COMMON_FONTS_DIRECTORY); + _BORK(B_COMMON_LIB_DIRECTORY); + _BORK(B_COMMON_SERVERS_DIRECTORY); + _BORK(B_COMMON_BIN_DIRECTORY); + _BORK(B_COMMON_ETC_DIRECTORY); + _BORK(B_COMMON_DOCUMENTATION_DIRECTORY); + _BORK(B_COMMON_SETTINGS_DIRECTORY); + _BORK(B_COMMON_DEVELOP_DIRECTORY); + _BORK(B_COMMON_LOG_DIRECTORY); + _BORK(B_COMMON_SPOOL_DIRECTORY); + _BORK(B_COMMON_TEMP_DIRECTORY); + _BORK(B_COMMON_VAR_DIRECTORY); + _BORK(B_COMMON_TRANSLATORS_DIRECTORY); + _BORK(B_COMMON_MEDIA_NODES_DIRECTORY); + _BORK(B_COMMON_SOUNDS_DIRECTORY); + + _BORK(B_USER_DIRECTORY); + _BORK(B_USER_CONFIG_DIRECTORY); + _BORK(B_USER_ADDONS_DIRECTORY); + _BORK(B_USER_BOOT_DIRECTORY); + _BORK(B_USER_FONTS_DIRECTORY); + _BORK(B_USER_LIB_DIRECTORY); + _BORK(B_USER_SETTINGS_DIRECTORY); + _BORK(B_USER_DESKBAR_DIRECTORY); + _BORK(B_USER_PRINTERS_DIRECTORY); + _BORK(B_USER_TRANSLATORS_DIRECTORY); + _BORK(B_USER_MEDIA_NODES_DIRECTORY); + _BORK(B_USER_SOUNDS_DIRECTORY); + + _BORK(B_APPS_DIRECTORY); + _BORK(B_PREFERENCES_DIRECTORY); + _BORK(B_UTILITIES_DIRECTORY); + + return B_OK; +} + +#undef _BORK + +// copy a file including its attributes +#define BUFF_SZ 1024*1024 +status_t copy_file(entry_ref *ref, const char *to) +{ + char *buff; + status_t err = B_OK; + //off_t off; + //size_t got; + (void)ref; (void)to; + + buff = (char *)malloc(BUFF_SZ); + // XXX: TODO + + + free(buff); + return err; +} + + +int testhook() +{ + status_t err; + BString str("/boot/home/config/fonts/ttfonts/toto.ttf"); + err = escape_find_directory(&str); + printf("error 0x%08lx %s\n", err, str.String()); + err = unescape_find_directory(&str); + printf("error 0x%08lx %s\n", err, str.String()); + return 0; + return 1; +} + +status_t +FindRGBColor(BMessage &message, const char *name, int32 index, rgb_color *c) +{ +#ifdef B_BEOS_VERSION_DANO + return message.FindRGBColor(name, index, c); +#else + const void *data; + ssize_t len; + status_t err; + err = message.FindData(name, index, &data, &len); + if (err < B_OK) + return err; + if (len > (ssize_t)sizeof(*c)) + return E2BIG; + // Hack + memcpy((void *)c, data, len); + return B_OK; +#endif +} + + +status_t +AddRGBColor(BMessage &message, const char *name, rgb_color a_color, type_code type) +{ +#ifdef B_BEOS_VERSION_DANO + return message.AddRGBColor(name, a_color, type); +#else + return message.AddData(name, type, &a_color, sizeof(a_color)); +#endif +} + + +status_t +FindFont(BMessage &message, const char *name, int32 index, BFont *f) +{ +#ifdef B_BEOS_VERSION_DANO + return message.FindFlat(name, index, f); +#else + const void *data; + ssize_t len; + status_t err = message.FindData(name, index, &data, &len); + if (err < B_OK) + return err; + if (len > (ssize_t)sizeof(*f)) + return E2BIG; + // Hack: only Dano has BFont : public BFlattenable + memcpy((void *)f, data, len); + return B_OK; +#endif +} + + +status_t +AddFont(BMessage &message, const char *name, BFont *f, int32 count = 1) +{ +#ifdef B_BEOS_VERSION_DANO + return message.AddFlat(name, f, count); +#else + return message.AddData(name, 'FONt', (void *)&f, sizeof(f), true, count); +#endif +} + Copied: haiku/trunk/3rdparty/mmu_man/themes/Utils.h (from rev 23417, haiku/trunk/3rdparty/mmu_man/themes/FileUtils.h) =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/FileUtils.h 2008-01-11 20:42:27 UTC (rev 23417) +++ haiku/trunk/3rdparty/mmu_man/themes/Utils.h 2008-01-12 01:05:37 UTC (rev 23429) @@ -0,0 +1,32 @@ +#ifndef _FILE_UTILS_H +#define _FILE_UTILS_H + +#include +#include +#include +#include + +// find the font file corresponding to family/style +extern status_t find_font_file(entry_ref *to, font_family family, font_style style, float size =-1); + +// replace part of paths by symbolic strings "${B_FOO_DIRECTORY}" +extern status_t escape_find_directory(BString *dir); +extern status_t unescape_find_directory(BString *dir); + +// copy a file including its attributes +extern status_t copy_file(entry_ref *ref, const char *to); + +extern status_t FindRGBColor(BMessage &message, const char *name, int32 index, rgb_color *c); +extern status_t AddRGBColor(BMessage &message, const char *name, rgb_color a_color, type_code type = B_RGB_COLOR_TYPE); + +extern status_t FindFont(BMessage &message, const char *name, int32 index, BFont *f); +extern status_t AddFont(BMessage &message, const char *name, BFont *f, int32 count = 1); + +#ifdef B_BEOS_VERSION_DANO +#define GET_INFO_NAME_PTR(p) (const char **)(p) +#else +#define GET_INFO_NAME_PTR(p) (p) +#endif + + +#endif /* _FILE_UTILS_H */ Modified: haiku/trunk/3rdparty/mmu_man/themes/addons/BackgroundsAddon.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/addons/BackgroundsAddon.cpp 2008-01-12 00:52:57 UTC (rev 23428) +++ haiku/trunk/3rdparty/mmu_man/themes/addons/BackgroundsAddon.cpp 2008-01-12 01:05:37 UTC (rev 23429) @@ -21,6 +21,7 @@ #include "ThemesAddon.h" #include "UITheme.h" +#include "Utils.h" #ifdef SINGLE_BINARY #define instanciate_themes_addon instanciate_themes_addon_backgrounds @@ -136,7 +137,7 @@ // should work as the rest of the fields (grouping) for (int i = 0; i < count_workspaces(); i++) { //ssize_t sz = 4; - if (backgrounds.FindRGBColor(B__DESKTOP_COLOR, i, &col) != B_OK && i == 0) + if (FindRGBColor(backgrounds, B__DESKTOP_COLOR, i, &col) != B_OK && i == 0) //if (backgrounds.FindData(B__DESKTOP_COLOR, (type_code)'RGBC', i, (const void **)&c, &sz) != B_OK && i == 0) break; // if no color at all, don't set them bs.SetDesktopColor(col, i, true); @@ -224,7 +225,7 @@ //printf("ws col cnt %d\n", last_change); for (i = 0; i <= last_change; i++) { col = bs.DesktopColor(i); - backgrounds.AddRGBColor(B__DESKTOP_COLOR, col); + AddRGBColor(backgrounds, B__DESKTOP_COLOR, col); //backgrounds->AddData(B__DESKTOP_COLOR, (type_code)'RGBC', &col, 4); } @@ -242,7 +243,7 @@ BMessage backgrounds; rgb_color col = {51,102,152,255}; // Be Blues... ;) backgrounds.AddBool(B_BACKGROUND_ERASE_TEXT, true); - backgrounds.AddRGBColor(B__DESKTOP_COLOR, col); + AddRGBColor(backgrounds, B__DESKTOP_COLOR, col); theme.AddMessage(A_MSGNAME, &backgrounds); return ApplyTheme(theme, flags); } Modified: haiku/trunk/3rdparty/mmu_man/themes/addons/BeIDEAddon.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/addons/BeIDEAddon.cpp 2008-01-12 00:52:57 UTC (rev 23428) +++ haiku/trunk/3rdparty/mmu_man/themes/addons/BeIDEAddon.cpp 2008-01-12 01:05:37 UTC (rev 23429) @@ -20,6 +20,7 @@ #include "ThemesAddon.h" #include "UITheme.h" +#include "Utils.h" #ifdef SINGLE_BINARY #define instanciate_themes_addon instanciate_themes_addon_beide @@ -112,9 +113,9 @@ if (beideSettings.ReadAttr("AppEditorPrefs", 'rPWM', 0LL, &bp, sizeof(struct beide_editor_pref)) < B_OK) return B_ERROR; - if (uisettings.FindRGBColor(B_UI_DOCUMENT_BACKGROUND_COLOR, &col) >= B_OK) + if (FindRGBColor(uisettings, B_UI_DOCUMENT_BACKGROUND_COLOR, 0, &col) >= B_OK) bp.bg = col; - if (uisettings.FindRGBColor(B_UI_MENU_SELECTED_BACKGROUND_COLOR, &col) >= B_OK) + if (FindRGBColor(uisettings, B_UI_MENU_SELECTED_BACKGROUND_COLOR, 0, &col) >= B_OK) bp.selbg = col; if (true/* || flags & UI_THEME_SETTINGS_SAVE*/) { @@ -138,14 +139,14 @@ click.AddSpecifier("View", "listview"); click.AddSpecifier("Window", "Environment Preferences"); click.AddPoint("be:view_where", BPoint(58.0,103.0)); - err = msgr.SendMessage(click); + err = msgr.SendMessage(&click); msg.AddSpecifier("View", "Background"); msg.AddSpecifier("View", "colorsview"); msg.AddSpecifier("Window", "Environment Preferences"); msg.AddPoint("_drop_point_", BPoint(0,0)); msg.AddData("RGBColor", B_RGB_COLOR_TYPE, &bp.bg, 4); - err = msgr.SendMessage(msg); + err = msgr.SendMessage(&msg); msg.MakeEmpty(); msg.AddSpecifier("View", "Hilite"); @@ -153,12 +154,12 @@ msg.AddSpecifier("Window", "Environment Preferences"); msg.AddPoint("_drop_point_", BPoint(0,0)); msg.AddData("RGBColor", B_RGB_COLOR_TYPE, &bp.selbg, 4); - err = msgr.SendMessage(msg); + err = msgr.SendMessage(&msg); msg.MakeEmpty(); msg.what = 'SSav'; msg.AddSpecifier("Window", "Environment Preferences"); - err = msgr.SendMessage(msg); + err = msgr.SendMessage(&msg); } } } @@ -178,8 +179,8 @@ BMessage uisettings; rgb_color bg = {255, 255, 255, 255}; rgb_color selbg = {216, 216, 216, 255}; - uisettings.AddRGBColor(B_UI_DOCUMENT_BACKGROUND_COLOR, bg); - uisettings.AddRGBColor(B_UI_MENU_SELECTED_BACKGROUND_COLOR, selbg); + AddRGBColor(uisettings, B_UI_DOCUMENT_BACKGROUND_COLOR, bg); + AddRGBColor(uisettings, B_UI_MENU_SELECTED_BACKGROUND_COLOR, selbg); theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings); return ApplyTheme(theme, flags); } Copied: haiku/trunk/3rdparty/mmu_man/themes/addons/DanoUISettingsAddon.cpp (from rev 23417, haiku/trunk/3rdparty/mmu_man/themes/addons/UISettingsAddon.cpp) =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/addons/UISettingsAddon.cpp 2008-01-11 20:42:27 UTC (rev 23417) +++ haiku/trunk/3rdparty/mmu_man/themes/addons/DanoUISettingsAddon.cpp 2008-01-12 01:05:37 UTC (rev 23429) @@ -0,0 +1,207 @@ +/* + * ui_settings ThemesAddon class + */ + +#include +#ifdef B_BEOS_VERSION_DANO + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "ThemesAddon.h" +#include "UITheme.h" + +#ifdef SINGLE_BINARY +#define instanciate_themes_addon instanciate_themes_addon_ui_settings +#endif + +//#define A_NAME "UI Settings" +#define A_NAME "System Colors and Fonts" +#define A_MSGNAME Z_THEME_UI_SETTINGS +#define A_DESCRIPTION "System colors, fonts and other goodies" + +class UISettingsThemesAddon : public ThemesAddon { +public: + UISettingsThemesAddon(); + ~UISettingsThemesAddon(); + +const char *Description(); + +status_t RunPreferencesPanel(); + +status_t AddNames(BMessage &names); + +status_t ApplyTheme(BMessage &theme, uint32 flags=0L); +status_t MakeTheme(BMessage &theme, uint32 flags=0L); + +status_t ApplyDefaultTheme(uint32 flags=0L); +}; + +UISettingsThemesAddon::UISettingsThemesAddon() + : ThemesAddon(A_NAME, A_MSGNAME) +{ +} + +UISettingsThemesAddon::~UISettingsThemesAddon() +{ +} + +const char *UISettingsThemesAddon::Description() +{ + return A_DESCRIPTION; +} + +status_t UISettingsThemesAddon::RunPreferencesPanel() +{ + status_t err = B_OK; + entry_ref ref; + BEntry ent; + /* + err = ent.SetTo("/boot/beos/preferences/Colors"); + if (!err) { + err = ent.GetRef(&ref); + if (!err) { + err = be_roster->Launch(&ref); + } + } + */ + if (!err) + return B_OK; + err = ent.SetTo("/system/add-ons/Preferences/Appearance"); + if (!err) { + err = ent.GetRef(&ref); + if (!err) { + err = be_roster->Launch(&ref); + if (err) { + BMessage msg(B_REFS_RECEIVED); + msg.AddRef("refs", &ref); + be_app_messenger.SendMessage(&msg); + } + } + } + return err; +} + +status_t UISettingsThemesAddon::AddNames(BMessage &names) +{ + BMessage uisettings; + BMessage uinames; + status_t err; + const char *str, *value; + type_code code; + int32 i; + + err = get_ui_settings(&uisettings, &uinames); + if (err) + return err; + names.AddString(Z_THEME_UI_SETTINGS, "UI Settings"); + // hack for legacy fonts + names.AddString("be:f:be_plain_font", "System Plain"); + names.AddString("be:f:be_bold_font", "System Bold"); + names.AddString("be:f:be_fixed_font", "System Fixed"); + for (i = 0; uinames.GetInfo(B_STRING_TYPE, i, &str, &code) == B_OK;i++) + if (uinames.FindString(str, &value) == B_OK) + names.AddString(str, value); + return B_OK; +} + +status_t UISettingsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) +{ + BMessage uisettings; + BFont fnt; + status_t err; + + (void)flags; + err = MyMessage(theme, uisettings); + if (err) + return err; + + // hack for legacy fonts + err = uisettings.FindFlat("be:f:be_plain_font", &fnt); + uisettings.RemoveName("be:f:be_plain_font"); + if (err == B_OK) + BFont::SetStandardFont(B_PLAIN_FONT, &fnt); + + err = uisettings.FindFlat("be:f:be_bold_font", &fnt); + uisettings.RemoveName("be:f:be_bold_font"); + if (err == B_OK) + BFont::SetStandardFont(B_BOLD_FONT, &fnt); + + err = uisettings.FindFlat("be:f:be_fixed_font", &fnt); + uisettings.RemoveName("be:f:be_fixed_font"); + if (err == B_OK) + BFont::SetStandardFont(B_FIXED_FONT, &fnt); + + + update_ui_settings(uisettings); + + + return B_OK; +} + +status_t UISettingsThemesAddon::MakeTheme(BMessage &theme, uint32 flags) +{ + BMessage uisettings; + BMessage names; + BFont fnt; + status_t err; + + (void)flags; + err = MyMessage(theme, uisettings); + if (err) + uisettings.MakeEmpty(); + + err = get_ui_settings(&uisettings, &names); + if (err) + return err; + + // hack for legacy fonts + err = BFont::GetStandardFont(B_PLAIN_FONT, &fnt); + uisettings.AddFlat("be:f:be_plain_font", &fnt); + err = BFont::GetStandardFont(B_BOLD_FONT, &fnt); + uisettings.AddFlat("be:f:be_bold_font", &fnt); + err = BFont::GetStandardFont(B_FIXED_FONT, &fnt); + uisettings.AddFlat("be:f:be_fixed_font", &fnt); + + err = SetMyMessage(theme, uisettings); + return err; +} + +status_t UISettingsThemesAddon::ApplyDefaultTheme(uint32 flags) +{ + BMessage theme; + BMessage uisettings; + BFont fnt; + status_t err; + + err = get_default_settings(&uisettings); + if (err) + return err; + + // hack for legacy fonts + err = BFont::GetStandardFont((font_which)(B_PLAIN_FONT-100), &fnt); + uisettings.AddFlat("be:f:be_plain_font", &fnt); + err = BFont::GetStandardFont((font_which)(B_BOLD_FONT-100), &fnt); + uisettings.AddFlat("be:f:be_bold_font", &fnt); + err = BFont::GetStandardFont((font_which)(B_FIXED_FONT-100), &fnt); + uisettings.AddFlat("be:f:be_fixed_font", &fnt); + + theme.AddMessage(A_MSGNAME, &uisettings); + return ApplyTheme(theme, flags); +} + + +ThemesAddon *instanciate_themes_addon() +{ + return (ThemesAddon *) new UISettingsThemesAddon; +} + +#endif /* B_BEOS_VERSION_DANO */ Modified: haiku/trunk/3rdparty/mmu_man/themes/addons/DanoWindowDecorAddon.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/addons/DanoWindowDecorAddon.cpp 2008-01-12 00:52:57 UTC (rev 23428) +++ haiku/trunk/3rdparty/mmu_man/themes/addons/DanoWindowDecorAddon.cpp 2008-01-12 01:05:37 UTC (rev 23429) @@ -2,6 +2,9 @@ * window_decor ThemesAddon class */ +#include +#ifdef B_BEOS_VERSION_DANO + #include #include #include @@ -155,3 +158,5 @@ { [... truncated: 293 lines follow ...] From mmu_man at mail.berlios.de Sat Jan 12 02:11:45 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 12 Jan 2008 02:11:45 +0100 Subject: [Haiku-commits] r23430 - in haiku/trunk/3rdparty/mmu_man/themes: . addons Message-ID: <200801120111.m0C1BjDY027329@sheep.berlios.de> Author: mmu_man Date: 2008-01-12 02:11:45 +0100 (Sat, 12 Jan 2008) New Revision: 23430 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23430&view=rev Added: haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp Modified: haiku/trunk/3rdparty/mmu_man/themes/MakeScreenshot.cpp haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp Log: * Linking fixes * Will put Haiku code there... Modified: haiku/trunk/3rdparty/mmu_man/themes/MakeScreenshot.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/MakeScreenshot.cpp 2008-01-12 01:05:37 UTC (rev 23429) +++ haiku/trunk/3rdparty/mmu_man/themes/MakeScreenshot.cpp 2008-01-12 01:11:45 UTC (rev 23430) @@ -39,7 +39,10 @@ scaledBmp = new BBitmap(scaledBounds, B_BITMAP_ACCEPTS_VIEWS, B_RGB32/*shot->ColorSpace()*/); err = scaledBmp->InitCheck(); if (!err) { + err = ENOSYS; +#ifdef B_ZETA_VERSION err = ScaleBitmap(*shot, *scaledBmp); +#endif if (err) { // filtered scaling didn't work, do it manually BView *v = new BView(scaledBounds, "scaleview", B_FOLLOW_NONE, 0); Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp 2008-01-12 01:05:37 UTC (rev 23429) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp 2008-01-12 01:11:45 UTC (rev 23430) @@ -700,7 +700,11 @@ if (shot) { BBitmap scaled(fScreenshotPane->Bounds(), B_RGB32); - if( B_OK == ScaleBitmap(*shot, scaled) ) + status_t err = ENOSYS; +#ifdef B_ZETA_VERSION + err = ScaleBitmap(*shot, scaled); +#endif + if( err == B_OK ) { fScreenshotPane->SetViewBitmap(&scaled); } Added: haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp 2008-01-12 01:05:37 UTC (rev 23429) +++ haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp 2008-01-12 01:11:45 UTC (rev 23430) @@ -0,0 +1,208 @@ +/* + * ui_settings ThemesAddon class + */ + +#include +//#ifdef B_BEOS_VERSION_DANO +#if 0 + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "ThemesAddon.h" +#include "UITheme.h" + +#ifdef SINGLE_BINARY +#define instanciate_themes_addon instanciate_themes_addon_ui_settings +#endif + +//#define A_NAME "UI Settings" +#define A_NAME "System Colors and Fonts" +#define A_MSGNAME Z_THEME_UI_SETTINGS +#define A_DESCRIPTION "System colors, fonts and other goodies" + +class UISettingsThemesAddon : public ThemesAddon { +public: + UISettingsThemesAddon(); + ~UISettingsThemesAddon(); + +const char *Description(); + +status_t RunPreferencesPanel(); + +status_t AddNames(BMessage &names); + +status_t ApplyTheme(BMessage &theme, uint32 flags=0L); +status_t MakeTheme(BMessage &theme, uint32 flags=0L); + +status_t ApplyDefaultTheme(uint32 flags=0L); +}; + +UISettingsThemesAddon::UISettingsThemesAddon() + : ThemesAddon(A_NAME, A_MSGNAME) +{ +} + +UISettingsThemesAddon::~UISettingsThemesAddon() +{ +} + +const char *UISettingsThemesAddon::Description() +{ + return A_DESCRIPTION; +} + +status_t UISettingsThemesAddon::RunPreferencesPanel() +{ + status_t err = B_OK; + entry_ref ref; + BEntry ent; + /* + err = ent.SetTo("/boot/beos/preferences/Colors"); + if (!err) { + err = ent.GetRef(&ref); + if (!err) { + err = be_roster->Launch(&ref); + } + } + */ + if (!err) + return B_OK; + err = ent.SetTo("/system/add-ons/Preferences/Appearance"); + if (!err) { + err = ent.GetRef(&ref); + if (!err) { + err = be_roster->Launch(&ref); + if (err) { + BMessage msg(B_REFS_RECEIVED); + msg.AddRef("refs", &ref); + be_app_messenger.SendMessage(&msg); + } + } + } + return err; +} + +status_t UISettingsThemesAddon::AddNames(BMessage &names) +{ + BMessage uisettings; + BMessage uinames; + status_t err; + const char *str, *value; + type_code code; + int32 i; + + err = get_ui_settings(&uisettings, &uinames); + if (err) + return err; + names.AddString(Z_THEME_UI_SETTINGS, "UI Settings"); + // hack for legacy fonts + names.AddString("be:f:be_plain_font", "System Plain"); + names.AddString("be:f:be_bold_font", "System Bold"); + names.AddString("be:f:be_fixed_font", "System Fixed"); + for (i = 0; uinames.GetInfo(B_STRING_TYPE, i, &str, &code) == B_OK;i++) + if (uinames.FindString(str, &value) == B_OK) + names.AddString(str, value); + return B_OK; +} + +status_t UISettingsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) +{ + BMessage uisettings; + BFont fnt; + status_t err; + + (void)flags; + err = MyMessage(theme, uisettings); + if (err) + return err; + + // hack for legacy fonts + err = uisettings.FindFlat("be:f:be_plain_font", &fnt); + uisettings.RemoveName("be:f:be_plain_font"); + if (err == B_OK) + BFont::SetStandardFont(B_PLAIN_FONT, &fnt); + + err = uisettings.FindFlat("be:f:be_bold_font", &fnt); + uisettings.RemoveName("be:f:be_bold_font"); + if (err == B_OK) + BFont::SetStandardFont(B_BOLD_FONT, &fnt); + + err = uisettings.FindFlat("be:f:be_fixed_font", &fnt); + uisettings.RemoveName("be:f:be_fixed_font"); + if (err == B_OK) + BFont::SetStandardFont(B_FIXED_FONT, &fnt); + + + update_ui_settings(uisettings); + + + return B_OK; +} + +status_t UISettingsThemesAddon::MakeTheme(BMessage &theme, uint32 flags) +{ + BMessage uisettings; + BMessage names; + BFont fnt; + status_t err; + + (void)flags; + err = MyMessage(theme, uisettings); + if (err) + uisettings.MakeEmpty(); + + err = get_ui_settings(&uisettings, &names); + if (err) + return err; + + // hack for legacy fonts + err = BFont::GetStandardFont(B_PLAIN_FONT, &fnt); + uisettings.AddFlat("be:f:be_plain_font", &fnt); + err = BFont::GetStandardFont(B_BOLD_FONT, &fnt); + uisettings.AddFlat("be:f:be_bold_font", &fnt); + err = BFont::GetStandardFont(B_FIXED_FONT, &fnt); + uisettings.AddFlat("be:f:be_fixed_font", &fnt); + + err = SetMyMessage(theme, uisettings); + return err; +} + +status_t UISettingsThemesAddon::ApplyDefaultTheme(uint32 flags) +{ + BMessage theme; + BMessage uisettings; + BFont fnt; + status_t err; + + err = get_default_settings(&uisettings); + if (err) + return err; + + // hack for legacy fonts + err = BFont::GetStandardFont((font_which)(B_PLAIN_FONT-100), &fnt); + uisettings.AddFlat("be:f:be_plain_font", &fnt); + err = BFont::GetStandardFont((font_which)(B_BOLD_FONT-100), &fnt); + uisettings.AddFlat("be:f:be_bold_font", &fnt); + err = BFont::GetStandardFont((font_which)(B_FIXED_FONT-100), &fnt); + uisettings.AddFlat("be:f:be_fixed_font", &fnt); + + theme.AddMessage(A_MSGNAME, &uisettings); + return ApplyTheme(theme, flags); +} + + +ThemesAddon *instanciate_themes_addon() +{ + return (ThemesAddon *) new UISettingsThemesAddon; +} + +#endif /* B_BEOS_VERSION_DANO */ \ No newline at end of file Added: haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp 2008-01-12 01:05:37 UTC (rev 23429) +++ haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp 2008-01-12 01:11:45 UTC (rev 23430) @@ -0,0 +1,163 @@ +/* + * window_decor ThemesAddon class + */ + +#include +//#ifdef B_BEOS_VERSION_DANO +#if 0 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "ThemesAddon.h" +#include "UITheme.h" + +#ifdef SINGLE_BINARY +#define instanciate_themes_addon instanciate_themes_addon_window_decor +#endif + +#define A_NAME "Window Decor" +#define A_MSGNAME Z_THEME_WINDOW_DECORATIONS +#define A_DESCRIPTION "Window decorations and scrollbars" + +class DecorThemesAddon : public ThemesAddon { +public: + DecorThemesAddon(); + ~DecorThemesAddon(); + +const char *Description(); + +status_t RunPreferencesPanel(); + +status_t AddNames(BMessage &names); + +status_t ApplyTheme(BMessage &theme, uint32 flags=0L); +status_t MakeTheme(BMessage &theme, uint32 flags=0L); + +status_t ApplyDefaultTheme(uint32 flags=0L); +}; + +DecorThemesAddon::DecorThemesAddon() + : ThemesAddon(A_NAME, A_MSGNAME) +{ +} + +DecorThemesAddon::~DecorThemesAddon() +{ +} + +const char *DecorThemesAddon::Description() +{ + return A_DESCRIPTION; +} + +status_t DecorThemesAddon::RunPreferencesPanel() +{ + status_t err; + entry_ref ref; + BEntry ent; + err = ent.SetTo("/system/add-ons/Preferences/Appearance"); + if (!err) { + err = ent.GetRef(&ref); + if (!err) { + err = be_roster->Launch(&ref); + if (err) { + BMessage msg(B_REFS_RECEIVED); + msg.AddRef("refs", &ref); + be_app_messenger.SendMessage(&msg); + } + } + } + return err; +} + +status_t DecorThemesAddon::AddNames(BMessage &names) +{ + names.AddString(Z_THEME_WINDOW_DECORATIONS, "Window decorations and scrollbars"); + names.AddString("window:decor", "Window decor"); + names.AddString("window:decor_globals", "Window decor parameters"); + return B_OK; +} + +status_t DecorThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) +{ + BMessage window_decor; + BMessage globals; + BString decorName; + status_t err; + + (void)flags; + err = MyMessage(theme, window_decor); + if (err) + return err; + +#ifdef B_BEOS_VERSION_DANO + if (window_decor.FindString("window:decor", &decorName) == B_OK) + set_window_decor(decorName.String(), + (window_decor.FindMessage("window:decor_globals", &globals) == B_OK)?&globals:NULL); +#else +extern void __set_window_decor(int32 theme); + int32 decorNr = 0; + if (window_decor.FindInt32("window:R5:decor", &decorNr) == B_OK) + __set_window_decor(decorNr); +#endif + // XXX: add colors ? la WindowShade ? + + return B_OK; +} + +status_t DecorThemesAddon::MakeTheme(BMessage &theme, uint32 flags) +{ + BMessage window_decor; + BMessage globals; + BString decorName; + status_t err; + + (void)flags; + err = MyMessage(theme, window_decor); + if (err) + window_decor.MakeEmpty(); + +#ifdef B_BEOS_VERSION_DANO + err = get_window_decor(&decorName, &globals); + if (err == B_OK) { + window_decor.AddString("window:decor", decorName.String()); + window_decor.AddMessage("window:decor_globals", &globals); + } +#else + window_decor.AddInt32("window:R5:decor", 0); +#endif + + err = SetMyMessage(theme, window_decor); + return err; +} + +status_t DecorThemesAddon::ApplyDefaultTheme(uint32 flags) +{ + BMessage theme; + BMessage window_decor; + window_decor.AddString("window:decor", "R5"); + window_decor.AddInt32("window:R5:decor", 0L); + theme.AddMessage(A_MSGNAME, &window_decor); + return ApplyTheme(theme, flags); +} + + +ThemesAddon *instanciate_themes_addon() +{ + return (ThemesAddon *) new DecorThemesAddon; +} + +#endif /* B_BEOS_VERSION_DANO */ From mmu_man at mail.berlios.de Sat Jan 12 02:22:51 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 12 Jan 2008 02:22:51 +0100 Subject: [Haiku-commits] r23431 - in haiku/trunk/3rdparty/mmu_man/themes: . addons Message-ID: <200801120122.m0C1Mpa4029867@sheep.berlios.de> Author: mmu_man Date: 2008-01-12 02:22:47 +0100 (Sat, 12 Jan 2008) New Revision: 23431 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23431&view=rev Modified: haiku/trunk/3rdparty/mmu_man/themes/Jamfile haiku/trunk/3rdparty/mmu_man/themes/Utils.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp Log: Now builds for Haiku. Missing Haiku specific code though. Modified: haiku/trunk/3rdparty/mmu_man/themes/Jamfile =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/Jamfile 2008-01-12 01:11:45 UTC (rev 23430) +++ haiku/trunk/3rdparty/mmu_man/themes/Jamfile 2008-01-12 01:22:47 UTC (rev 23431) @@ -15,6 +15,7 @@ DeskbarAddon.cpp EddieAddon.cpp HaikuUISettingsAddon.cpp + HaikuWindowDecorAddon.cpp PeAddon.cpp ScreensaverAddon.cpp SoundplayColorAddon.cpp Modified: haiku/trunk/3rdparty/mmu_man/themes/Utils.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/Utils.cpp 2008-01-12 01:11:45 UTC (rev 23430) +++ haiku/trunk/3rdparty/mmu_man/themes/Utils.cpp 2008-01-12 01:22:47 UTC (rev 23431) @@ -2,6 +2,8 @@ #include #include #include +#include + #include #include @@ -34,7 +36,8 @@ status_t find_font_file(entry_ref *to, font_family family, font_style style, float size) { - status_t err; + status_t err = ENOENT; +#ifdef B_BEOS_VERSION_DANO long i, fontcount, foldercount; font_file_info *ffi; font_folder_info *fdi; @@ -67,6 +70,7 @@ printf("find_font_file: found\n."); return ent.GetRef(to); } +#endif return ENOENT; } Modified: haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp 2008-01-12 01:11:45 UTC (rev 23430) +++ haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp 2008-01-12 01:22:47 UTC (rev 23431) @@ -3,8 +3,7 @@ */ #include -//#ifdef B_BEOS_VERSION_DANO -#if 0 +#ifdef B_HAIKU_VERSION_1 #include #include @@ -24,6 +23,14 @@ #define instanciate_themes_addon instanciate_themes_addon_ui_settings #endif +//XXX: FIXME +ThemesAddon *instanciate_themes_addon() +{ + return NULL; +} + +#if 0 // DANO... + //#define A_NAME "UI Settings" #define A_NAME "System Colors and Fonts" #define A_MSGNAME Z_THEME_UI_SETTINGS @@ -205,4 +212,6 @@ return (ThemesAddon *) new UISettingsThemesAddon; } +#endif + #endif /* B_BEOS_VERSION_DANO */ \ No newline at end of file Modified: haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp 2008-01-12 01:11:45 UTC (rev 23430) +++ haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp 2008-01-12 01:22:47 UTC (rev 23431) @@ -3,8 +3,7 @@ */ #include -//#ifdef B_BEOS_VERSION_DANO -#if 0 +#ifdef B_HAIKU_VERSION_1 #include #include @@ -28,6 +27,14 @@ #define instanciate_themes_addon instanciate_themes_addon_window_decor #endif +//XXX: FIXME +ThemesAddon *instanciate_themes_addon() +{ + return NULL; +} + +#if 0 // DANO... + #define A_NAME "Window Decor" #define A_MSGNAME Z_THEME_WINDOW_DECORATIONS #define A_DESCRIPTION "Window decorations and scrollbars" @@ -160,4 +167,6 @@ return (ThemesAddon *) new DecorThemesAddon; } +#endif + #endif /* B_BEOS_VERSION_DANO */ From mmu_man at mail.berlios.de Sat Jan 12 02:36:28 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 12 Jan 2008 02:36:28 +0100 Subject: [Haiku-commits] r23432 - haiku/trunk/data/system/boot Message-ID: <200801120136.m0C1aSHU031438@sheep.berlios.de> Author: mmu_man Date: 2008-01-12 02:36:28 +0100 (Sat, 12 Jan 2008) New Revision: 23432 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23432&view=rev Modified: haiku/trunk/data/system/boot/Bootscript Log: This should probably work better when multiuser is not enabled. Modified: haiku/trunk/data/system/boot/Bootscript =================================================================== --- haiku/trunk/data/system/boot/Bootscript 2008-01-12 01:22:47 UTC (rev 23431) +++ haiku/trunk/data/system/boot/Bootscript 2008-01-12 01:36:28 UTC (rev 23432) @@ -87,8 +87,13 @@ # Launch Terminal or consoled depending on $SAFEMODE if [ "$SAFEMODE" != "yes" ]; then - launch beos/system/Tracker - launch beos/system/Deskbar + if [ -e /etc/users ]; then + launch beos/system/Login + # nothing more + else + launch beos/system/Tracker + launch beos/system/Deskbar + fi launch beos/apps/Terminal else launch beos/bin/consoled From marcusoverhagen at mail.berlios.de Sat Jan 12 02:56:34 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 12 Jan 2008 02:56:34 +0100 Subject: [Haiku-commits] r23433 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801120156.m0C1uYpZ001263@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-12 02:56:33 +0100 (Sat, 12 Jan 2008) New Revision: 23433 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23433&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c Log: fixed multi block data transfer Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-12 01:36:28 UTC (rev 23432) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-12 01:56:33 UTC (rev 23433) @@ -783,7 +783,7 @@ // if no timeout is specified, use standard timeout = request->ccb->timeout > 0 ? request->ccb->timeout * 1000 : IDE_STD_TIMEOUT; - if (device->is_atapi) + if (!device->is_atapi) flags |= ATA_DRDY_REQUIRED; if (request->uses_dma) flags |= ATA_DMA_TRANSFER; @@ -819,15 +819,17 @@ uint32 timeout = request->ccb->timeout > 0 ? request->ccb->timeout * 1000 : IDE_STD_TIMEOUT; -// FLOW("ata_exec_pio_transfer: length %d, left_sg_elem %d, cur_sg_elem %d, cur_sg_ofs %d\n", -// request->ccb->data_length, device->left_sg_elem, device->cur_sg_elem, device->cur_sg_ofs); + FLOW("ata_exec_pio_transfer: length %d, left_blocks %d, left_sg_elem %d, cur_sg_ofs %d\n", + request->ccb->data_length, device->left_blocks, device->left_sg_elem, device->cur_sg_ofs); - if (ata_wait(bus, ide_status_drq, ide_status_bsy, 0, 4000000) != B_OK) { - TRACE("ata_exec_pio_transfer: wait failed\n"); - goto error; - } while (device->left_blocks > 0) { + + if (ata_wait(bus, ide_status_drq, ide_status_bsy, 0, 4000000) != B_OK) { + TRACE("ata_exec_pio_transfer: wait failed\n"); + goto error; + } + if (request->is_write) { // FLOW("writing 1 block\n"); if (write_PIO_block(request, 512) != B_OK) @@ -838,6 +840,11 @@ goto transfer_error; } device->left_blocks--; + + // wait 1 pio cycle + if (device->left_blocks) + bus->controller->get_altstatus(bus->channel_cookie); + // FLOW("%d blocks left\n", device->left_blocks); } From marcusoverhagen at mail.berlios.de Sat Jan 12 02:58:31 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 12 Jan 2008 02:58:31 +0100 Subject: [Haiku-commits] r23434 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801120158.m0C1wVEe001315@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-12 02:58:30 +0100 (Sat, 12 Jan 2008) New Revision: 23434 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23434&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c Log: fixed timeout and crash Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-12 01:56:33 UTC (rev 23433) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-12 01:58:30 UTC (rev 23434) @@ -853,7 +853,7 @@ goto error; } - ata_finish_command(device, &request, ATA_WAIT_FINISH | ATA_DRDY_REQUIRED, ide_error_abrt); + ata_finish_command(device, request, ATA_WAIT_FINISH | ATA_DRDY_REQUIRED, ide_error_abrt); ata_request_finish(request, false /* resubmit */); return; From marcusoverhagen at mail.berlios.de Sat Jan 12 11:32:11 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 12 Jan 2008 11:32:11 +0100 Subject: [Haiku-commits] r23435 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801121032.m0CAWBuF011178@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-12 11:32:10 +0100 (Sat, 12 Jan 2008) New Revision: 23435 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23435&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c Log: Removed debug output in the read/write path, and added it to other functions. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-12 01:58:30 UTC (rev 23434) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-12 10:32:10 UTC (rev 23435) @@ -819,8 +819,8 @@ uint32 timeout = request->ccb->timeout > 0 ? request->ccb->timeout * 1000 : IDE_STD_TIMEOUT; - FLOW("ata_exec_pio_transfer: length %d, left_blocks %d, left_sg_elem %d, cur_sg_ofs %d\n", - request->ccb->data_length, device->left_blocks, device->left_sg_elem, device->cur_sg_ofs); +// FLOW("ata_exec_pio_transfer: length %d, left_blocks %d, left_sg_elem %d, cur_sg_ofs %d\n", +// request->ccb->data_length, device->left_blocks, device->left_sg_elem, device->cur_sg_ofs); while (device->left_blocks > 0) { Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-12 01:58:30 UTC (rev 23434) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-12 10:32:10 UTC (rev 23435) @@ -99,8 +99,9 @@ ASSERT(ccb); - TRACE("ata_request_finish: request %p, subsys_status 0x%02x, senseKey %02x\n", - request, ccb->subsys_status, request->senseKey); + if (ccb->subsys_status != SCSI_REQ_CMP || request->senseKey) + TRACE("ata_request_finish: request %p, subsys_status 0x%02x, senseKey %02x\n", + request, ccb->subsys_status, request->senseKey); // when the request completed and has set sense // data, report this to the scsci stack by setting Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-12 01:58:30 UTC (rev 23434) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/scsi2ata.c 2008-01-12 10:32:10 UTC (rev 23435) @@ -249,6 +249,8 @@ static bool scsi_synchronize_cache(ide_device_info *device, ata_request *request) { + TRACE("scsi_synchronize_cache\n"); + // we should also ask for FLUSH CACHE support, but everyone denies it // (looks like they cheat to gain some performance advantage, but // that's pretty useless: everyone does it...) @@ -276,6 +278,8 @@ static bool scsi_load_eject(ide_device_info *device, ata_request *request, bool load) { + TRACE("scsi_load_eject\n"); + if (load) { // ATA doesn't support loading ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_PARAM_NOT_SUPPORTED); @@ -370,6 +374,8 @@ scsi_cmd_read_capacity *cmd = (scsi_cmd_read_capacity *)ccb->cdb; uint32 lastBlock; + TRACE("scsi_read_capacity\n"); + if (cmd->pmi || cmd->lba) { ata_request_set_sense(request, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_CDB_FIELD); return; @@ -394,6 +400,8 @@ scsi_sense sense; uint32 transferSize; + TRACE("scsi_request_sense\n"); + // Copy sense data from last request into data buffer of current request. // The sense data of last request is still present in the current request, // as is isn't been cleared by ata_exec_io for SCSI_OP_REQUEST_SENSE. From axeld at mail.berlios.de Sat Jan 12 12:29:57 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 12 Jan 2008 12:29:57 +0100 Subject: [Haiku-commits] r23436 - haiku/trunk/src/bin/strace Message-ID: <200801121129.m0CBTvL3015486@sheep.berlios.de> Author: axeld Date: 2008-01-12 12:29:57 +0100 (Sat, 12 Jan 2008) New Revision: 23436 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23436&view=rev Modified: haiku/trunk/src/bin/strace/strace.cpp Log: * Applied patch by absabs to enable signal tracing. This closes ticket #1436. Thanks! * Changed syscall color to blue (signals are red). * Added thread number to the signal output. * -g turns off signal tracing now. Modified: haiku/trunk/src/bin/strace/strace.cpp =================================================================== --- haiku/trunk/src/bin/strace/strace.cpp 2008-01-12 10:32:10 UTC (rev 23435) +++ haiku/trunk/src/bin/strace/strace.cpp 2008-01-12 11:29:57 UTC (rev 23436) @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007, Ingo Weinhold, bonefish at users.sf.net. + * Copyright 2005-2008, Ingo Weinhold, bonefish at users.sf.net. * Distributed under the terms of the MIT License. */ @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,7 @@ " ID.\n" " -o - directs output into the specified file.\n" " -S - prints output to serial debug line.\n" +" -g - turns off signal tracing.\n" ; // terminal color escape sequences @@ -83,7 +85,40 @@ static const char *kTerminalTextNormal = "\33[0m"; static const char *kTerminalTextRed = "\33[31m"; static const char *kTerminalTextMagenta = "\33[35m"; +static const char *kTerminalTextBlue = "\33[34m"; +static const char *kSignalName[] = { + /* 0 */ "SIG0", + /* 1 */ "SIGHUP", + /* 2 */ "SIGINT", + /* 3 */ "SIGQUIT", + /* 4 */ "SIGILL", + /* 5 */ "SIGCHLD", + /* 6 */ "SIGABRT", + /* 7 */ "SIGPIPE", + /* 8 */ "SIGFPE", + /* 9 */ "SIGKILL", + /* 10 */ "SIGSTOP", + /* 11 */ "SIGSEGV", + /* 12 */ "SIGCONT", + /* 13 */ "SIGTSTP", + /* 14 */ "SIGALRM", + /* 15 */ "SIGTERM", + /* 16 */ "SIGTTIN", + /* 17 */ "SIGTTOU", + /* 18 */ "SIGUSR1", + /* 19 */ "SIGUSR2", + /* 20 */ "SIGWINCH", + /* 21 */ "SIGKILLTHR", + /* 22 */ "SIGTRAP", + /* 23 */ "SIGPOLL", + /* 24 */ "SIGPROF", + /* 25 */ "SIGSYS", + /* 26 */ "SIGURG", + /* 27 */ "SIGVTALRM", + /* 28 */ "SIGXCPU", + /* 29 */ "SIGXFSZ", +}; // command line args static int sArgc; @@ -362,7 +397,7 @@ // print syscall name if (colorize) { print_to_string(&string, &length, "[%6ld] %s%s%s(", - message.origin.thread, kTerminalTextRed, syscall->Name().c_str(), + message.origin.thread, kTerminalTextBlue, syscall->Name().c_str(), kTerminalTextNormal); } else { print_to_string(&string, &length, "[%6ld] %s(", @@ -432,7 +467,46 @@ _kern_debug_output(buffer); } +static +const char * +signal_name(int signal) +{ + if (signal >= 0 && signal < NSIG) + return kSignalName[signal]; + static char buffer[32]; + sprintf(buffer, "%d", signal); + return buffer; +} + +// print_signal +static +void +print_signal(FILE *outputFile, debug_signal_received &message, + bool colorize) +{ + char buffer[4096], *string = buffer; + int32 length = (int32)sizeof(buffer); + int signalNumber = message.signal; + + // print signal name + if (colorize) { + print_to_string(&string, &length, "[%6ld] --- %s%s (%s) %s---\n", + message.origin.thread, kTerminalTextRed, signal_name(signalNumber), + strsignal(signalNumber), kTerminalTextNormal); + } else { + print_to_string(&string, &length, "[%6ld] --- %s (%s) ---\n", + message.origin.thread, signal_name(signalNumber), + strsignal(signalNumber)); + } + + // output either to file or serial debug line + if (outputFile != NULL) + fwrite(buffer, sizeof(buffer) - length, 1, outputFile); + else + _kern_debug_output(buffer); +} + // main int main(int argc, const char *const *argv) @@ -452,6 +526,7 @@ bool printReturnValues = true; bool traceChildThreads = false; bool traceTeam = false; + bool traceSignal = true; bool serialOutput = false; FILE *outputFile = stdout; @@ -503,6 +578,8 @@ traceChildThreads = true; } else if (strcmp(arg, "-T") == 0) { traceTeam = true; + } else if (strcmp(arg, "-g") == 0) { + traceSignal = false; } else if (strcmp(arg, "-S") == 0) { serialOutput = true; outputFile = NULL; @@ -596,7 +673,8 @@ } // set team debugging flags - int32 teamDebugFlags = (traceTeam ? B_TEAM_DEBUG_POST_SYSCALL : 0); + int32 teamDebugFlags = (traceTeam ? B_TEAM_DEBUG_POST_SYSCALL : 0) + | (traceSignal ? B_TEAM_DEBUG_SIGNALS : 0); set_team_debugging_flags(nubPort, teamDebugFlags); // set thread debugging flags @@ -636,9 +714,17 @@ case B_DEBUGGER_MESSAGE_POST_SYSCALL: { print_syscall(outputFile, message.post_syscall, memoryReader, - printArguments, contentsFlags, printReturnValues, - colorize, decimalFormat); + printArguments, contentsFlags, printReturnValues, + colorize, decimalFormat); + break; + } + case B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED: + { + if (traceSignal) { + print_signal(outputFile, message.signal_received, + colorize); + } break; } @@ -648,7 +734,6 @@ case B_DEBUGGER_MESSAGE_WATCHPOINT_HIT: case B_DEBUGGER_MESSAGE_SINGLE_STEP: case B_DEBUGGER_MESSAGE_PRE_SYSCALL: - case B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED: case B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED: case B_DEBUGGER_MESSAGE_TEAM_CREATED: case B_DEBUGGER_MESSAGE_THREAD_CREATED: From axeld at mail.berlios.de Sat Jan 12 13:42:05 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 12 Jan 2008 13:42:05 +0100 Subject: [Haiku-commits] r23437 - haiku/trunk/src/apps/terminal Message-ID: <200801121242.m0CCg53r006865@sheep.berlios.de> Author: axeld Date: 2008-01-12 13:41:55 +0100 (Sat, 12 Jan 2008) New Revision: 23437 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23437&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.cpp Log: * Made the colors of our Terminal a bit easier to look at, especially in the ls output. * Made the array the size it actually is. Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2008-01-12 11:29:57 UTC (rev 23436) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2008-01-12 12:41:55 UTC (rev 23437) @@ -47,15 +47,15 @@ extern int function_keycode_table[]; extern char *function_key_char_table[]; -const static rgb_color kTermColorTable[16] = { - { 0, 0, 0, 0}, - {255, 0, 0, 0}, - { 0, 255, 0, 0}, - {255, 255, 0, 0}, - { 0, 0, 255, 0}, - {255, 0, 255, 0}, - { 0, 255, 255, 0}, - {255, 255, 255, 0}, +const static rgb_color kTermColorTable[8] = { + { 40, 40, 40, 0}, // black + {204, 0, 0, 0}, // red + { 78, 154, 6, 0}, // green + {218, 168, 0, 0}, // yellow + { 51, 102, 152, 0}, // blue + {115, 68, 123, 0}, // magenta + { 6, 152, 154, 0}, // cyan + {245, 245, 245, 0}, // white }; From axeld at mail.berlios.de Sat Jan 12 14:18:00 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 12 Jan 2008 14:18:00 +0100 Subject: [Haiku-commits] r23438 - haiku/trunk/src/system/libroot/posix/sys Message-ID: <200801121318.m0CDI0Db009480@sheep.berlios.de> Author: axeld Date: 2008-01-12 14:17:59 +0100 (Sat, 12 Jan 2008) New Revision: 23438 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23438&view=rev Modified: haiku/trunk/src/system/libroot/posix/sys/mkdir.c Log: mkdir() is supposed to respect the umask when creating the directory. Modified: haiku/trunk/src/system/libroot/posix/sys/mkdir.c =================================================================== --- haiku/trunk/src/system/libroot/posix/sys/mkdir.c 2008-01-12 12:41:55 UTC (rev 23437) +++ haiku/trunk/src/system/libroot/posix/sys/mkdir.c 2008-01-12 13:17:59 UTC (rev 23438) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2002-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -9,6 +9,10 @@ #include +extern mode_t __gUmask; + // declared in sys/umask.c + + #define RETURN_AND_SET_ERRNO(err) \ if (err < 0) { \ errno = err; \ @@ -20,7 +24,7 @@ int mkdir(const char* path, mode_t mode) { - status_t status = _kern_create_dir(-1, path, mode); + status_t status = _kern_create_dir(-1, path, mode & ~__gUmask); RETURN_AND_SET_ERRNO(status); } From korli at mail.berlios.de Sat Jan 12 16:51:02 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 12 Jan 2008 16:51:02 +0100 Subject: [Haiku-commits] r23439 - haiku/trunk/src/system/libroot/posix/unistd Message-ID: <200801121551.m0CFp2ox025473@sheep.berlios.de> Author: korli Date: 2008-01-12 16:51:02 +0100 (Sat, 12 Jan 2008) New Revision: 23439 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23439&view=rev Modified: haiku/trunk/src/system/libroot/posix/unistd/system.cpp Log: system() should continue to wait when wait_for_thread returns B_INTERRUPTED fixes bug #1707 Modified: haiku/trunk/src/system/libroot/posix/unistd/system.cpp =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/system.cpp 2008-01-12 13:17:59 UTC (rev 23438) +++ haiku/trunk/src/system/libroot/posix/unistd/system.cpp 2008-01-12 15:51:02 UTC (rev 23439) @@ -27,7 +27,11 @@ } status_t returnValue; - status_t error = wait_for_thread(thread, &returnValue); + status_t error; + do { + error = wait_for_thread(thread, &returnValue); + } while (error == B_INTERRUPTED); + if (error != B_OK) { errno = error; return -1; From mmu_man at mail.berlios.de Sat Jan 12 17:04:44 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 12 Jan 2008 17:04:44 +0100 Subject: [Haiku-commits] r23440 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801121604.m0CG4igA026258@sheep.berlios.de> Author: mmu_man Date: 2008-01-12 17:04:44 +0100 (Sat, 12 Jan 2008) New Revision: 23440 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23440&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h Modified: haiku/trunk/src/system/boot/platform/atari_m68k/start.c Log: * x86 mmu init code, to be changed. * remove some unneeded stuff in start. * we just quit the boot prg instead of rebooting (should try Puntaes also) Added: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp 2008-01-12 15:51:02 UTC (rev 23439) +++ haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp 2008-01-12 16:04:44 UTC (rev 23440) @@ -0,0 +1,689 @@ +/* + * Copyright 2004-2007, Axel D?rfler, axeld at pinc-software.de. + * Based on code written by Travis Geiselbrecht for NewOS. + * + * Distributed under the terms of the MIT License. + */ + + +#include "mmu.h" +#include "bios.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + + +/** The (physical) memory layout of the boot loader is currently as follows: + * 0x0500 - 0x10000 protected mode stack + * 0x0500 - 0x09000 real mode stack + * 0x10000 - ? code (up to ~500 kB) + * 0x90000 1st temporary page table (identity maps 0-4 MB) + * 0x91000 2nd (4-8 MB) + * 0x92000 - 0x92000 further page tables + * 0x9e000 - 0xa0000 SMP trampoline code + * [0xa0000 - 0x100000 BIOS/ROM/reserved area] + * 0x100000 page directory + * ... boot loader heap (32 kB) + * ... free physical memory + * + * The first 8 MB are identity mapped (0x0 - 0x0800000); paging is turned + * on. The kernel is mapped at 0x80000000, all other stuff mapped by the + * loader (kernel args, modules, driver settings, ...) comes after + * 0x81000000 which means that there is currently only 1 MB reserved for + * the kernel itself (see kMaxKernelSize). + */ + +//#define TRACE_MMU +#ifdef TRACE_MMU +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + +struct gdt_idt_descr { + uint16 limit; + uint32 *base; +} _PACKED; + +// memory structure returned by int 0x15, ax 0xe820 +struct extended_memory { + uint64 base_addr; + uint64 length; + uint32 type; +}; + +#ifdef _PXE_ENV + +static const uint32 kDefaultPageTableFlags = 0x07; // present, user, R/W +static const size_t kMaxKernelSize = 0x100000; // 1 MB for the kernel + +// working page directory and page table +static uint32 *sPageDirectory = 0; + +static addr_t sNextPhysicalAddress = 0x112000; +static addr_t sNextVirtualAddress = KERNEL_BASE + kMaxKernelSize; +static addr_t sMaxVirtualAddress = KERNEL_BASE + 0x400000; + +static addr_t sNextPageTableAddress = 0x7d000; +static const uint32 kPageTableRegionEnd = 0x8b000; + // we need to reserve 2 pages for the SMP trampoline code + +#else + +static const uint32 kDefaultPageTableFlags = 0x07; // present, user, R/W +static const size_t kMaxKernelSize = 0x100000; // 1 MB for the kernel + +// working page directory and page table +static uint32 *sPageDirectory = 0; + +static addr_t sNextPhysicalAddress = 0x100000; +static addr_t sNextVirtualAddress = KERNEL_BASE + kMaxKernelSize; +static addr_t sMaxVirtualAddress = KERNEL_BASE + 0x400000; + +static addr_t sNextPageTableAddress = 0x90000; +static const uint32 kPageTableRegionEnd = 0x9e000; + // we need to reserve 2 pages for the SMP trampoline code + +#endif + + +static addr_t +get_next_virtual_address(size_t size) +{ + addr_t address = sNextVirtualAddress; + sNextVirtualAddress += size; + + return address; +} + + +static addr_t +get_next_physical_address(size_t size) +{ + addr_t address = sNextPhysicalAddress; + sNextPhysicalAddress += size; + + return address; +} + + +static addr_t +get_next_virtual_page() +{ + return get_next_virtual_address(B_PAGE_SIZE); +} + + +static addr_t +get_next_physical_page() +{ + return get_next_physical_address(B_PAGE_SIZE); +} + + +static uint32 * +get_next_page_table() +{ + TRACE(("get_next_page_table, sNextPageTableAddress %p, kPageTableRegionEnd %p\n", + sNextPageTableAddress, kPageTableRegionEnd)); + + addr_t address = sNextPageTableAddress; + if (address >= kPageTableRegionEnd) + return (uint32 *)get_next_physical_page(); + + sNextPageTableAddress += B_PAGE_SIZE; + return (uint32 *)address; +} + + +/** Adds a new page table for the specified base address */ + +static void +add_page_table(addr_t base) +{ + TRACE(("add_page_table(base = %p)\n", (void *)base)); + + // Get new page table and clear it out + uint32 *pageTable = get_next_page_table(); + if (pageTable > (uint32 *)(8 * 1024 * 1024)) + panic("tried to add page table beyond the indentity mapped 8 MB region\n"); + + gKernelArgs.arch_args.pgtables[gKernelArgs.arch_args.num_pgtables++] = (uint32)pageTable; + + for (int32 i = 0; i < 1024; i++) + pageTable[i] = 0; + + // put the new page table into the page directory + sPageDirectory[base/(4*1024*1024)] = (uint32)pageTable | kDefaultPageTableFlags; +} + + +static void +unmap_page(addr_t virtualAddress) +{ + TRACE(("unmap_page(virtualAddress = %p)\n", (void *)virtualAddress)); + + if (virtualAddress < KERNEL_BASE) + panic("unmap_page: asked to unmap invalid page %p!\n", (void *)virtualAddress); + + // unmap the page from the correct page table + uint32 *pageTable = (uint32 *)(sPageDirectory[virtualAddress + / (B_PAGE_SIZE * 1024)] & 0xfffff000); + pageTable[(virtualAddress % (B_PAGE_SIZE * 1024)) / B_PAGE_SIZE] = 0; + + asm volatile("invlpg (%0)" : : "r" (virtualAddress)); +} + + +/** Creates an entry to map the specified virtualAddress to the given + * physicalAddress. + * If the mapping goes beyond the current page table, it will allocate + * a new one. If it cannot map the requested page, it panics. + */ + +static void +map_page(addr_t virtualAddress, addr_t physicalAddress, uint32 flags) +{ + TRACE(("map_page: vaddr 0x%lx, paddr 0x%lx\n", virtualAddress, physicalAddress)); + + if (virtualAddress < KERNEL_BASE) + panic("map_page: asked to map invalid page %p!\n", (void *)virtualAddress); + + if (virtualAddress >= sMaxVirtualAddress) { + // we need to add a new page table + + add_page_table(sMaxVirtualAddress); + sMaxVirtualAddress += B_PAGE_SIZE * 1024; + + if (virtualAddress >= sMaxVirtualAddress) + panic("map_page: asked to map a page to %p\n", (void *)virtualAddress); + } + + physicalAddress &= ~(B_PAGE_SIZE - 1); + + // map the page to the correct page table + uint32 *pageTable = (uint32 *)(sPageDirectory[virtualAddress + / (B_PAGE_SIZE * 1024)] & 0xfffff000); + uint32 tableEntry = (virtualAddress % (B_PAGE_SIZE * 1024)) / B_PAGE_SIZE; + + TRACE(("map_page: inserting pageTable %p, tableEntry %ld, physicalAddress %p\n", + pageTable, tableEntry, physicalAddress)); + + pageTable[tableEntry] = physicalAddress | flags; + + asm volatile("invlpg (%0)" : : "r" (virtualAddress)); + + TRACE(("map_page: done\n")); +} + + +static void +sort_addr_range(addr_range *range, int count) +{ + addr_range tempRange; + bool done; + int i; + + do { + done = true; + for (i = 1; i < count; i++) { + if (range[i].start < range[i - 1].start) { + done = false; + memcpy(&tempRange, &range[i], sizeof(addr_range)); + memcpy(&range[i], &range[i - 1], sizeof(addr_range)); + memcpy(&range[i - 1], &tempRange, sizeof(addr_range)); + } + } + } while (!done); +} + + +static uint32 +get_memory_map(extended_memory **_extendedMemory) +{ + extended_memory *block = (extended_memory *)kExtraSegmentScratch; + bios_regs regs = { 0, 0, sizeof(extended_memory), 0, 0, (uint32)block, 0, 0}; + uint32 count = 0; + + TRACE(("get_memory_map()\n")); + + do { + regs.eax = 0xe820; + regs.edx = 'SMAP'; + + call_bios(0x15, ®s); + if (regs.flags & CARRY_FLAG) + return 0; + + regs.edi += sizeof(extended_memory); + count++; + } while (regs.ebx != 0); + + *_extendedMemory = block; + +#ifdef TRACE_MMU + dprintf("extended memory info (from 0xe820):\n"); + for (uint32 i = 0; i < count; i++) { + dprintf(" base 0x%Lx, len 0x%Lx, type %lu\n", + block[i].base_addr, block[i].length, block[i].type); + } +#endif + + return count; +} + + +static void +init_page_directory(void) +{ + TRACE(("init_page_directory\n")); + + // allocate a new pgdir + sPageDirectory = (uint32 *)get_next_physical_page(); + gKernelArgs.arch_args.phys_pgdir = (uint32)sPageDirectory; + + // clear out the pgdir + for (int32 i = 0; i < 1024; i++) { + sPageDirectory[i] = 0; + } + + // Identity map the first 8 MB of memory so that their + // physical and virtual address are the same. + // These page tables won't be taken over into the kernel. + + // make the first page table at the first free spot + uint32 *pageTable = get_next_page_table(); + + for (int32 i = 0; i < 1024; i++) { + pageTable[i] = (i * 0x1000) | kDefaultPageFlags; + } + + sPageDirectory[0] = (uint32)pageTable | kDefaultPageFlags; + + // make the second page table + pageTable = get_next_page_table(); + + for (int32 i = 0; i < 1024; i++) { + pageTable[i] = (i * 0x1000 + 0x400000) | kDefaultPageFlags; + } + + sPageDirectory[1] = (uint32)pageTable | kDefaultPageFlags; + + gKernelArgs.arch_args.num_pgtables = 0; + add_page_table(KERNEL_BASE); + + // switch to the new pgdir and enable paging + asm("movl %0, %%eax;" + "movl %%eax, %%cr3;" : : "m" (sPageDirectory) : "eax"); + // Important. Make sure supervisor threads can fault on read only pages... + asm("movl %%eax, %%cr0" : : "a" ((1 << 31) | (1 << 16) | (1 << 5) | 1)); +} + + +// #pragma mark - + + +extern "C" addr_t +mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint32 flags) +{ + addr_t address = sNextVirtualAddress; + addr_t pageOffset = physicalAddress & (B_PAGE_SIZE - 1); + + physicalAddress -= pageOffset; + + for (addr_t offset = 0; offset < size; offset += B_PAGE_SIZE) { + map_page(get_next_virtual_page(), physicalAddress + offset, flags); + } + + return address + pageOffset; +} + + +extern "C" void * +mmu_allocate(void *virtualAddress, size_t size) +{ + TRACE(("mmu_allocate: requested vaddr: %p, next free vaddr: 0x%lx, size: %ld\n", + virtualAddress, sNextVirtualAddress, size)); + + size = (size + B_PAGE_SIZE - 1) / B_PAGE_SIZE; + // get number of pages to map + + if (virtualAddress != NULL) { + // This special path is almost only useful for loading the + // kernel into memory; it will only allow you to map the + // 1 MB following the kernel base address. + // Also, it won't check for already mapped addresses, so + // you better know why you are here :) + addr_t address = (addr_t)virtualAddress; + + // is the address within the valid range? + if (address < KERNEL_BASE || address + size >= KERNEL_BASE + kMaxKernelSize) + return NULL; + + for (uint32 i = 0; i < size; i++) { + map_page(address, get_next_physical_page(), kDefaultPageFlags); + address += B_PAGE_SIZE; + } + + return virtualAddress; + } + + void *address = (void *)sNextVirtualAddress; + + for (uint32 i = 0; i < size; i++) { + map_page(get_next_virtual_page(), get_next_physical_page(), kDefaultPageFlags); + } + + return address; +} + + +/** This will unmap the allocated chunk of memory from the virtual + * address space. It might not actually free memory (as its implementation + * is very simple), but it might. + */ + +extern "C" void +mmu_free(void *virtualAddress, size_t size) +{ + TRACE(("mmu_free(virtualAddress = %p, size: %ld)\n", virtualAddress, size)); + + addr_t address = (addr_t)virtualAddress; + size = (size + B_PAGE_SIZE - 1) / B_PAGE_SIZE; + // get number of pages to map + + // is the address within the valid range? + if (address < KERNEL_BASE + || address + size >= KERNEL_BASE + kMaxKernelSize) { + panic("mmu_free: asked to unmap out of range region (%p, size %lx)\n", + (void *)address, size); + } + + // unmap all pages within the range + for (uint32 i = 0; i < size; i++) { + unmap_page(address); + address += B_PAGE_SIZE; + } + + if (address == sNextVirtualAddress) { + // we can actually reuse the virtual address space + sNextVirtualAddress -= size; + } +} + + +/** Sets up the final and kernel accessible GDT and IDT tables. + * BIOS calls won't work any longer after this function has + * been called. + */ + +extern "C" void +mmu_init_for_kernel(void) +{ + TRACE(("mmu_init_for_kernel\n")); + // set up a new idt + { + struct gdt_idt_descr idtDescriptor; + uint32 *idt; + + // find a new idt + idt = (uint32 *)get_next_physical_page(); + gKernelArgs.arch_args.phys_idt = (uint32)idt; + + TRACE(("idt at %p\n", idt)); + + // map the idt into virtual space + gKernelArgs.arch_args.vir_idt = (uint32)get_next_virtual_page(); + map_page(gKernelArgs.arch_args.vir_idt, (uint32)idt, kDefaultPageFlags); + + // clear it out + uint32* virtualIDT = (uint32*)gKernelArgs.arch_args.vir_idt; + for (int32 i = 0; i < IDT_LIMIT / 4; i++) { + virtualIDT[i] = 0; + } + + // load the idt + idtDescriptor.limit = IDT_LIMIT - 1; + idtDescriptor.base = (uint32 *)gKernelArgs.arch_args.vir_idt; + + asm("lidt %0;" + : : "m" (idtDescriptor)); + + TRACE(("idt at virtual address 0x%lx\n", gKernelArgs.arch_args.vir_idt)); + } + + // set up a new gdt + { + struct gdt_idt_descr gdtDescriptor; + segment_descriptor *gdt; + + // find a new gdt + gdt = (segment_descriptor *)get_next_physical_page(); + gKernelArgs.arch_args.phys_gdt = (uint32)gdt; + + TRACE(("gdt at %p\n", gdt)); + + // map the gdt into virtual space + gKernelArgs.arch_args.vir_gdt = (uint32)get_next_virtual_page(); + map_page(gKernelArgs.arch_args.vir_gdt, (uint32)gdt, kDefaultPageFlags); + + // put standard segment descriptors in it + segment_descriptor* virtualGDT + = (segment_descriptor*)gKernelArgs.arch_args.vir_gdt; + clear_segment_descriptor(&virtualGDT[0]); + + // seg 0x08 - kernel 4GB code + set_segment_descriptor(&virtualGDT[1], 0, 0xffffffff, DT_CODE_READABLE, + DPL_KERNEL); + + // seg 0x10 - kernel 4GB data + set_segment_descriptor(&virtualGDT[2], 0, 0xffffffff, DT_DATA_WRITEABLE, + DPL_KERNEL); + + // seg 0x1b - ring 3 user 4GB code + set_segment_descriptor(&virtualGDT[3], 0, 0xffffffff, DT_CODE_READABLE, + DPL_USER); + + // seg 0x23 - ring 3 user 4GB data + set_segment_descriptor(&virtualGDT[4], 0, 0xffffffff, DT_DATA_WRITEABLE, + DPL_USER); + + // virtualGDT[5] and above will be filled later by the kernel + // to contain the TSS descriptors, and for TLS (one for every CPU) + + // load the GDT + gdtDescriptor.limit = GDT_LIMIT - 1; + gdtDescriptor.base = (uint32 *)gKernelArgs.arch_args.vir_gdt; + + asm("lgdt %0;" + : : "m" (gdtDescriptor)); + + TRACE(("gdt at virtual address %p\n", (void *)gKernelArgs.arch_args.vir_gdt)); + } + + // save the memory we've physically allocated + gKernelArgs.physical_allocated_range[0].size = sNextPhysicalAddress - gKernelArgs.physical_allocated_range[0].start; + + // save the memory we've virtually allocated (for the kernel and other stuff) + gKernelArgs.virtual_allocated_range[0].start = KERNEL_BASE; + gKernelArgs.virtual_allocated_range[0].size = sNextVirtualAddress - KERNEL_BASE; + gKernelArgs.num_virtual_allocated_ranges = 1; + + // sort the address ranges + sort_addr_range(gKernelArgs.physical_memory_range, gKernelArgs.num_physical_memory_ranges); + sort_addr_range(gKernelArgs.physical_allocated_range, gKernelArgs.num_physical_allocated_ranges); + sort_addr_range(gKernelArgs.virtual_allocated_range, gKernelArgs.num_virtual_allocated_ranges); + +#ifdef TRACE_MMU + { + uint32 i; + + dprintf("phys memory ranges:\n"); + for (i = 0; i < gKernelArgs.num_physical_memory_ranges; i++) { + dprintf(" base 0x%08lx, length 0x%08lx\n", gKernelArgs.physical_memory_range[i].start, gKernelArgs.physical_memory_range[i].size); + } + + dprintf("allocated phys memory ranges:\n"); + for (i = 0; i < gKernelArgs.num_physical_allocated_ranges; i++) { + dprintf(" base 0x%08lx, length 0x%08lx\n", gKernelArgs.physical_allocated_range[i].start, gKernelArgs.physical_allocated_range[i].size); + } + + dprintf("allocated virt memory ranges:\n"); + for (i = 0; i < gKernelArgs.num_virtual_allocated_ranges; i++) { + dprintf(" base 0x%08lx, length 0x%08lx\n", gKernelArgs.virtual_allocated_range[i].start, gKernelArgs.virtual_allocated_range[i].size); + } + } +#endif +} + + +extern "C" void +mmu_init(void) +{ + TRACE(("mmu_init\n")); + + gKernelArgs.physical_allocated_range[0].start = sNextPhysicalAddress; + gKernelArgs.physical_allocated_range[0].size = 0; + gKernelArgs.num_physical_allocated_ranges = 1; + // remember the start of the allocated physical pages + + init_page_directory(); + + // Map the page directory into kernel space at 0xffc00000-0xffffffff + // this enables a mmu trick where the 4 MB region that this pgdir entry + // represents now maps the 4MB of potential pagetables that the pgdir + // points to. Thrown away later in VM bringup, but useful for now. + sPageDirectory[1023] = (uint32)sPageDirectory | kDefaultPageFlags; + + // also map it on the next vpage + gKernelArgs.arch_args.vir_pgdir = get_next_virtual_page(); + map_page(gKernelArgs.arch_args.vir_pgdir, (uint32)sPageDirectory, kDefaultPageFlags); + + // map in a kernel stack + gKernelArgs.cpu_kstack[0].start = (addr_t)mmu_allocate(NULL, KERNEL_STACK_SIZE); + gKernelArgs.cpu_kstack[0].size = KERNEL_STACK_SIZE; + + TRACE(("kernel stack at 0x%lx to 0x%lx\n", gKernelArgs.cpu_kstack[0].start, + gKernelArgs.cpu_kstack[0].start + gKernelArgs.cpu_kstack[0].size)); + + extended_memory *extMemoryBlock; + uint32 extMemoryCount = get_memory_map(&extMemoryBlock); + + // figure out the memory map + if (extMemoryCount > 0) { + gKernelArgs.num_physical_memory_ranges = 0; + + for (uint32 i = 0; i < extMemoryCount; i++) { + // Type 1 is available memory + if (extMemoryBlock[i].type == 1) { + // round everything up to page boundaries, exclusive of pages + // it partially occupies + extMemoryBlock[i].length -= (extMemoryBlock[i].base_addr % B_PAGE_SIZE) + ? (B_PAGE_SIZE - (extMemoryBlock[i].base_addr % B_PAGE_SIZE)) : 0; + extMemoryBlock[i].base_addr = ROUNDUP(extMemoryBlock[i].base_addr, B_PAGE_SIZE); + extMemoryBlock[i].length = ROUNDOWN(extMemoryBlock[i].length, B_PAGE_SIZE); + + // we ignore all memory beyond 4 GB + if (extMemoryBlock[i].base_addr > 0xffffffffULL) + continue; + if (extMemoryBlock[i].base_addr + extMemoryBlock[i].length > 0xffffffffULL) + extMemoryBlock[i].length = 0x100000000ULL - extMemoryBlock[i].base_addr; + + if (gKernelArgs.num_physical_memory_ranges > 0) { + // we might want to extend a previous hole + addr_t previousEnd = gKernelArgs.physical_memory_range[ + gKernelArgs.num_physical_memory_ranges - 1].start + + gKernelArgs.physical_memory_range[ + gKernelArgs.num_physical_memory_ranges - 1].size; + addr_t holeSize = extMemoryBlock[i].base_addr - previousEnd; + + // if the hole is smaller than 1 MB, we try to mark the memory + // as allocated and extend the previous memory range + if (previousEnd <= extMemoryBlock[i].base_addr + && holeSize < 0x100000 + && insert_physical_allocated_range(previousEnd, + extMemoryBlock[i].base_addr - previousEnd) == B_OK) { + gKernelArgs.physical_memory_range[ + gKernelArgs.num_physical_memory_ranges - 1].size += holeSize; + } + } + + insert_physical_memory_range(extMemoryBlock[i].base_addr, + extMemoryBlock[i].length); + } + } + } else { + // ToDo: for now! + dprintf("No extended memory block - using 32 MB (fix me!)\n"); + uint32 memSize = 32 * 1024 * 1024; + + // we dont have an extended map, assume memory is contiguously mapped at 0x0 + gKernelArgs.physical_memory_range[0].start = 0; + gKernelArgs.physical_memory_range[0].size = memSize; + gKernelArgs.num_physical_memory_ranges = 1; + + // mark the bios area allocated + gKernelArgs.physical_allocated_range[gKernelArgs.num_physical_allocated_ranges].start = 0x9f000; // 640k - 1 page + gKernelArgs.physical_allocated_range[gKernelArgs.num_physical_allocated_ranges].size = 0x61000; + gKernelArgs.num_physical_allocated_ranges++; + } + + gKernelArgs.arch_args.page_hole = 0xffc00000; +} + + +// #pragma mark - + + +extern "C" status_t +platform_allocate_region(void **_address, size_t size, uint8 protection, + bool /*exactAddress*/) +{ + void *address = mmu_allocate(*_address, size); + if (address == NULL) + return B_NO_MEMORY; + + *_address = address; + return B_OK; +} + + +extern "C" status_t +platform_free_region(void *address, size_t size) +{ + mmu_free(address, size); + return B_OK; +} + + +void +platform_release_heap(struct stage2_args *args, void *base) +{ + // It will be freed automatically, since it is in the + // identity mapped region, and not stored in the kernel's + // page tables. +} + + +status_t +platform_init_heap(struct stage2_args *args, void **_base, void **_top) +{ + void *heap = (void *)get_next_physical_address(args->heap_size); + if (heap == NULL) + return B_NO_MEMORY; + + *_base = heap; + *_top = (void *)((int8 *)heap + args->heap_size); + return B_OK; +} + + Added: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h 2008-01-12 15:51:02 UTC (rev 23439) +++ haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h 2008-01-12 16:04:44 UTC (rev 23440) @@ -0,0 +1,29 @@ +/* + * Copyright 2004-2005, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef MMU_H +#define MMU_H + + +#include + + +// For use with mmu_map_physical_memory() +static const uint32 kDefaultPageFlags = 0x3; // present, R/W + +#ifdef __cplusplus +extern "C" { +#endif + +extern void mmu_init(void); +extern void mmu_init_for_kernel(void); +extern addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint32 flags); +extern void *mmu_allocate(void *virtualAddress, size_t size); +extern void mmu_free(void *virtualAddress, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* MMU_H */ Modified: haiku/trunk/src/system/boot/platform/atari_m68k/start.c =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/start.c 2008-01-12 15:51:02 UTC (rev 23439) +++ haiku/trunk/src/system/boot/platform/atari_m68k/start.c 2008-01-12 16:04:44 UTC (rev 23440) @@ -72,10 +72,10 @@ // or I don't see something important... addr_t stackTop = gKernelArgs.cpu_kstack[0].start + gKernelArgs.cpu_kstack[0].size; - smp_init_other_cpus(); - serial_cleanup(); + //smp_init_other_cpus(); + //serial_cleanup(); mmu_init_for_kernel(); - smp_boot_other_cpus(); + //smp_boot_other_cpus(); dprintf("kernel entry at %lx\n", gKernelArgs.kernel_image.elf_header.e_entry); @@ -96,8 +96,9 @@ void platform_exit(void) { - // reset the system using the keyboard controller - out8(0xfe, 0x64); + // Terminate + // XXX: Puntaes() instead ? + Pterm0(); } @@ -126,7 +127,7 @@ // reading the keyboard doesn't seem to work in graphics mode (maybe a bochs problem) sBootOptions = check_for_boot_keys(); //if (sBootOptions & BOOT_OPTION_DEBUG_OUTPUT) - serial_enable(); + //serial_enable(); //apm_init(); //smp_init(); From mmlr at mail.berlios.de Sat Jan 12 17:05:17 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 12 Jan 2008 17:05:17 +0100 Subject: [Haiku-commits] r23441 - haiku/trunk/src/system/kernel/fs Message-ID: <200801121605.m0CG5HOC026320@sheep.berlios.de> Author: mmlr Date: 2008-01-12 17:05:17 +0100 (Sat, 12 Jan 2008) New Revision: 23441 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23441&view=rev Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp Log: * Properly implement rescan in devfs (rescan when closed and republish when open) * Cache the looked up image symbols as well as the API version in the driver entry Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/devfs.cpp 2008-01-12 16:04:44 UTC (rev 23440) +++ haiku/trunk/src/system/kernel/fs/devfs.cpp 2008-01-12 16:05:17 UTC (rev 23441) @@ -129,9 +129,19 @@ ino_t node; time_t last_modified; image_id image; + + // driver image information + int32 *api_version; + device_hooks *(*find_device)(const char *); + const char **(*publish_devices)(void); }; +struct node_path_entry : DoublyLinkedListLinkImpl { + char path[B_PATH_NAME_LENGTH]; +}; + + static void get_device_name(struct devfs_vnode *vnode, char *buffer, size_t size); static status_t publish_device(struct devfs *fs, const char *path, @@ -141,6 +151,7 @@ /* the one and only allowed devfs instance */ static struct devfs *sDeviceFileSystem = NULL; +static int32 sDefaultApiVersion = 1; // #pragma mark - driver private @@ -198,20 +209,19 @@ // For a valid device driver the following exports are required - int32 defaultApiVersion = 1; - int32 *apiVersion = &defaultApiVersion; + driver->api_version = &sDefaultApiVersion; if (get_image_symbol(image, "api_version", B_SYMBOL_TYPE_DATA, - (void **)&apiVersion) == B_OK) { + (void **)&driver->api_version) == B_OK) { #if B_CUR_DRIVER_API_VERSION != 2 // just in case someone decides to bump up the api version #error Add checks here for new vs old api version! #endif - if (*apiVersion > B_CUR_DRIVER_API_VERSION) { - dprintf("%s: api_version %ld not handled\n", name, *apiVersion); + if (*driver->api_version > B_CUR_DRIVER_API_VERSION) { + dprintf("%s: api_version %ld not handled\n", name, *driver->api_version); status = B_BAD_VALUE; goto error1; } - if (*apiVersion < 1) { + if (*driver->api_version < 1) { dprintf("%s: api_version invalid\n", name); status = B_BAD_VALUE; goto error1; @@ -219,12 +229,10 @@ } else dprintf("%s: api_version missing\n", name); - device_hooks *(*find_device)(const char *); - const char **(*publish_devices)(void); if (get_image_symbol(image, "publish_devices", B_SYMBOL_TYPE_TEXT, - (void **)&publish_devices) != B_OK + (void **)&driver->publish_devices) != B_OK || get_image_symbol(image, "find_device", B_SYMBOL_TYPE_TEXT, - (void **)&find_device) != B_OK) { + (void **)&driver->find_device) != B_OK) { dprintf("%s: mandatory driver symbol(s) missing!\n", name); status = B_BAD_VALUE; goto error1; @@ -255,7 +263,7 @@ // ToDo: we could/should always unload drivers until they will be used for real // ToDo: this function is probably better kept in devfs, so that it could remember // the driver stuff (and even keep it loaded if there is enough memory) - devicePaths = publish_devices(); + devicePaths = driver->publish_devices(); if (devicePaths == NULL) { dprintf("%s: publish_devices() returned NULL.\n", name); status = ENXIO; @@ -263,11 +271,11 @@ } for (; devicePaths[0]; devicePaths++) { - device_hooks *hooks = find_device(devicePaths[0]); + device_hooks *hooks = driver->find_device(devicePaths[0]); if (hooks != NULL && publish_device(sDeviceFileSystem, devicePaths[0], - NULL, NULL, driver, hooks, *apiVersion) == B_OK) + NULL, NULL, driver, hooks, *driver->api_version) == B_OK) exported++; } @@ -980,6 +988,103 @@ } +static status_t +republish_driver(driver_entry *driver) +{ + if (driver->image < 0) + return B_NO_INIT; + + RecursiveLocker locker(&sDeviceFileSystem->lock); + + // build the list of currently present devices by iterating through all + // present nodes + struct hash_iterator i; + hash_open(sDeviceFileSystem->vnode_hash, &i); + + devfs_vnode *vnode = (devfs_vnode *)hash_next( + sDeviceFileSystem->vnode_hash, &i); + + DoublyLinkedList currentNodes; + while (vnode) { + if (S_ISCHR(vnode->stream.type)) { + if (vnode->stream.u.dev.driver == driver) { + node_path_entry *path = new(std::nothrow) node_path_entry; + if (!path) { + while ((path = currentNodes.RemoveHead())) + delete path; + hash_close(sDeviceFileSystem->vnode_hash, &i, false); + return B_NO_MEMORY; + } + + get_device_name(vnode, path->path, sizeof(path->path)); + currentNodes.Add(path); + } + } + + vnode = (devfs_vnode *)hash_next(sDeviceFileSystem->vnode_hash, &i); + } + hash_close(sDeviceFileSystem->vnode_hash, &i, false); + + // now ask the driver for it's currently published devices + const char **devicePaths = driver->publish_devices(); + if (devicePaths == NULL) { + node_path_entry *entry = NULL; + while ((entry = currentNodes.RemoveHead())) + delete entry; + return B_ERROR; + } + + int32 exported = 0; + for (; devicePaths[0]; devicePaths++) { + bool present = false; + node_path_entry *entry = currentNodes.Head(); + while (entry) { + if (strncmp(entry->path, devicePaths[0], B_PATH_NAME_LENGTH) == 0) { + // this device was present before and still is -> no republish + currentNodes.Remove(entry); + delete entry; + exported++; + present = true; + break; + } + + entry = currentNodes.GetNext(entry); + } + + if (present) + continue; + + // the device was not present before -> publish it now + device_hooks *hooks = driver->find_device(devicePaths[0]); + if (hooks == NULL) + continue; + + dprintf("devfs: publishing new device \"%s\"\n", devicePaths[0]); + if (publish_device(sDeviceFileSystem, devicePaths[0], NULL, NULL, + driver, hooks, *driver->api_version) == B_OK) + exported++; + } + + // what's left in currentNodes was present but is not anymore -> unpublish + node_path_entry *entry = currentNodes.Head(); + while (entry) { + dprintf("devfs: unpublishing no more present \"%s\"\n", entry->path); + devfs_unpublish_device(entry->path, true); + node_path_entry *next = currentNodes.GetNext(entry); + currentNodes.Remove(entry); + delete entry; + entry = next; + } + + if (exported == 0) { + dprintf("devfs: driver \"%s\" does not publish any more nodes and could be unloaded\n", driver->path); + // ToDo: here we could unload the driver if it doesn't publish anything + } + + return B_OK; +} + + /** Construct complete device name (as used for device_open()). * This is safe to use only when the device is in use (and therefore * cannot be unpublished during the iteration). @@ -2455,6 +2560,7 @@ if (status == B_OK && disconnect) vfs_disconnect_vnode(sDeviceFileSystem->id, node->id); + remove_vnode(sDeviceFileSystem->id, node->id); put_vnode(sDeviceFileSystem->id, node->id); return status; } @@ -2482,6 +2588,8 @@ { TRACE(("devfs_rescan_driver: %s\n", driverName)); + RecursiveLocker locker(&sDeviceFileSystem->lock); + // iterate over the drivers and search a matching driverName struct hash_iterator i; hash_open(sDeviceFileSystem->driver_hash, &i); @@ -2497,8 +2605,13 @@ if (!strcmp(name, driverName)) { hash_close(sDeviceFileSystem->driver_hash, &i, false); - // ToDo: force a uninit/init cycle on the driver if loaded - return load_driver(driver); + if (driver->image < 0) { + // The driver is not yet loaded + return load_driver(driver); + } else { + // The driver is loaded, just republish its entries + return republish_driver(driver); + } } driver = (driver_entry *)hash_next(sDeviceFileSystem->driver_hash, &i); From mmlr at mail.berlios.de Sat Jan 12 17:13:02 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 12 Jan 2008 17:13:02 +0100 Subject: [Haiku-commits] r23442 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200801121613.m0CGD2hV027694@sheep.berlios.de> Author: mmlr Date: 2008-01-12 17:13:01 +0100 (Sat, 12 Jan 2008) New Revision: 23442 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23442&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/devlist.c haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c Log: * Fixed removing from device list with only one device info present * Removed now unnecessary devfs calls again * Add an explanation in device_removed() Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/devlist.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/devlist.c 2008-01-12 16:05:17 UTC (rev 23441) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/devlist.c 2008-01-12 16:13:01 UTC (rev 23442) @@ -48,9 +48,11 @@ acquire_sem(gDeviceListLock); - if (sDeviceList == device) + if (sDeviceList == device) { sDeviceList = device->next; - else { + --sDeviceCount; + gDeviceListChanged = true; + } else { hid_device_info *previous; for (previous = sDeviceList; previous != NULL; previous = previous->next) { if (previous->next == device) { Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-12 16:05:17 UTC (rev 23441) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/hid.c 2008-01-12 16:13:01 UTC (rev 23442) @@ -21,10 +21,6 @@ #include #include -#ifdef HAIKU_TARGET_PLATFORM_HAIKU -#include -#endif - #define MAX_BUTTONS 16 static status_t hid_device_added(const usb_device *dev, void **cookie); @@ -876,13 +872,13 @@ free(device->insns); delete_device(device); } else { + // If the input_server has opened us this will always be the case. + // We unpublish our node in the devfs which will notify the mouse + // add-on to unregister and release us. DPRINTF_INFO((MY_ID "%s still open\n", device->name)); device->active = false; } -#ifdef HAIKU_TARGET_PLATFORM_HAIKU - devfs_unpublish_device(device->name, true); -#endif return B_OK; } From nielx at mail.berlios.de Sat Jan 12 17:57:51 2008 From: nielx at mail.berlios.de (nielx at BerliOS) Date: Sat, 12 Jan 2008 17:57:51 +0100 Subject: [Haiku-commits] r23443 - haiku/trunk/docs/user/app Message-ID: <200801121657.m0CGvpqK030159@sheep.berlios.de> Author: nielx Date: 2008-01-12 17:57:50 +0100 (Sat, 12 Jan 2008) New Revision: 23443 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23443&view=rev Modified: haiku/trunk/docs/user/app/Handler.dox Log: Fix the description for StartWatching() after a hint from Axel. There are two different behaviours for both overloaded variants. (which is bad, IMO) *waves at Axel* Modified: haiku/trunk/docs/user/app/Handler.dox =================================================================== --- haiku/trunk/docs/user/app/Handler.dox 2008-01-12 16:13:01 UTC (rev 23442) +++ haiku/trunk/docs/user/app/Handler.dox 2008-01-12 16:57:50 UTC (rev 23443) @@ -239,8 +239,9 @@ base class. Eventually, it will reach the default implementation, which will reply with a \c B_MESSAGE_NOT_UNDERSTOOD constant. - \warning Do not delete or otherwise cripple the \a message argument. It - does not belong to you. + \attention If you want to keep or manipulate the \a message, have a look + at the \link BLooper::DetachMessage() DetachMessage() \endlink method + to get ownership of the message. \param message The message that needs to be handled. */ @@ -461,6 +462,12 @@ Handlers can function as state machines, which emit messages to observers when the state changes. Use the following methods to subscribe to these notifications. + + Note that there is a semantic difference between the two StartWatching() + methods. The overloaded method that accepts a BHandler, expects as + argument an \a observer that watches this handler. The method that + accepts a BMessenger, expects a \a target that emits the state changes + to this handler. */ @@ -469,12 +476,23 @@ /*! \fn status_t BHandler::StartWatching(BMessenger target, uint32 what) - \brief Subscribe a \a target to watch a specific state change. + \brief Subscribe this handler to watch a specific state change of a + \a target. - Use this method to subscribe messengers. This means that also observers - from other teams can be subscribed. + Use this method to subscribe messengers to watch state changes in this + handler. This means that also observers from other teams can be + subscribed. - \param target The messenger to which notifications need to be send. +\code + // Handler B watches Handler A + BHandler A, B; + BMessenger messengerA(&A) + + B.StartWatching(messengerA, kNetworkConnection); +\endcode + + \param target The messenger from which the notifications would be + received. \param what The state that needs to be watched. \return During the call of this method, a notification will be transmitted using the \a target. If this works, then this method will return @@ -485,20 +503,21 @@ /*! \fn status_t BHandler::StartWatchingAll(BMessenger target) - \brief Subscribe a \a target to all events. + \brief Subscribe this handler to watch a \a target for all events. This method performs the same task as StartWatching(BMessenger, uint32), - but it will subscribe the target to all the state changes this handler - knows. + but it will subscribe to all the state changes the \a target knows. + \see StartWatching(BMessenger, uint32), StopWatchingAll(BMessenger) */ /*! \fn status_t BHandler::StopWatching(BMessenger target, uint32 what) - \brief Unsubscribe an observer from watching a specific state. + \brief Unsubscribe this handler from watching a specific state. - This method will unsubscribe the \a target from watching a specific event. + This method will unsubscribe this handler from watching a specific event + in a \a target. \see StartWatching(BMessenger, uint32) */ @@ -506,7 +525,7 @@ /*! \fn status_t BHandler::StopWatchingAll(BMessenger target) - \brief Unsubscribe an observer from watching all states. + \brief Unsubscribe this handler from watching all states. This method will unsubscribe the \a target from watching all state changes. @@ -515,32 +534,42 @@ /*! - \fn status_t BHandler::StartWatching(BHandler* handler, uint32 what) - \brief Subscribe another \a handler to watch a specific state change. + \fn status_t BHandler::StartWatching(BHandler* observer, uint32 what) + \brief Subscribe an \a observer for a specific state change of this handler. - Use this method to subscribe handlers. Since pointers to handlers can only + Use this method to subscribe observers to watch this handler. State changes + of this handler that match the \a what argment, will be sent. + +\code + // Handler B wants to observe Handler A + BHandler A, B; + + A.StartWatching(&B, kNetworkConnection); +\endcode + + Since pointers to handlers can only exist in the local namespace, have a look at StartWatching(BMessenger, uint32) for inter-team watching. - \param handler The handler to which notifications need to be send. + \param observer The observer for this handler. \param what The state that needs to be watched. \return During the call of this method, a notification will be transmitted - using the \a handler. If this works, then this method will return + using the \a observer. If this works, then this method will return \c B_OK. - \see StartWatchingAll(BHandler), StopWatching(BHandler, uint32) + \see StartWatchingAll(BHandler*), StopWatching(BHandler*, uint32) */ /*! - \fn status_t BHandler::StartWatchingAll(BHandler* handler) - \brief Subscribe another \a handler to watch all state changes. + \fn status_t BHandler::StartWatchingAll(BHandler* observer) + \brief Subscribe an \a observer for a all state changes. + This method performs the same task as StartWatching(BHandler, uint32), + but it will subscribe the \a observer to all the state changes this handler + tracks. - This method performs the same task as StartWatching(BHandler, uint32), - but it will subscribe the target to all the state changes this handler - knows. - \see StartWatching(BHandler, uint32), StopWatchingAll(BHandler) + \see StartWatching(BHandler*, uint32), StopWatchingAll(BHandler*) */ @@ -550,7 +579,7 @@ This method will unsubscribe the \a handler from watching a specific event. - \see StartWatching(BHandler, uint32) + \see StartWatching(BHandler*, uint32) */ @@ -560,7 +589,7 @@ This method will unsubscribe the \a handler from watching all state changes. - \see StartWatchingAll(BHandler) + \see StartWatchingAll(BHandler*) */ From korli at mail.berlios.de Sat Jan 12 18:05:14 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 12 Jan 2008 18:05:14 +0100 Subject: [Haiku-commits] r23444 - haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712 Message-ID: <200801121705.m0CH5EaP030825@sheep.berlios.de> Author: korli Date: 2008-01-12 18:05:13 +0100 (Sat, 12 Jan 2008) New Revision: 23444 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23444&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/Jamfile haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/ice1712.c haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/ice1712.h haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/io.c haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/multi.c haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/multi.h Log: update from Jerome Leveque Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/Jamfile 2008-01-12 16:57:50 UTC (rev 23443) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/Jamfile 2008-01-12 17:05:13 UTC (rev 23444) @@ -13,4 +13,3 @@ util.c ; - Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/ice1712.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/ice1712.c 2008-01-12 16:57:50 UTC (rev 23443) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/ice1712.c 2008-01-12 17:05:13 UTC (rev 23444) @@ -17,7 +17,6 @@ #include #include #include -#include #include "debug.h" #include "ice1712.h" @@ -25,7 +24,6 @@ #include "io.h" #include "midi_driver.h" #include "multi.h" -#include "multi_audio.h" #include "util.h" @@ -57,7 +55,8 @@ int32 api_version = B_CUR_DRIVER_API_VERSION; -#define MODULE_TEST_PATH "audio/hmulti/ice1712" +#define HMULTI_AUDIO_DEV_PATH "audio/hmulti/ice1712" +//#define HMULTI_AUDIO_DEV_PATH "audio/multi/ice1712" //------------------------------------------------------ //------------------------------------------------------ @@ -139,7 +138,6 @@ { int result, i; long result_l = 0; - uint8 eeprom_data[32]; uint8 reg8 = 0; ice->irq = ice->info.u.h0.interrupt_line; @@ -154,51 +152,74 @@ write_ccs_uint8(ice, CCS_CONTROL_STATUS, 0x01); snooze(200000); - result = read_eeprom(ice, eeprom_data); + result = read_eeprom(ice, ice->eeprom_data); - TRACE_ICE(("EEprom -> ")); +/* TRACE_ICE(("EEprom -> ")); for (i = 0; i < 32; i++) TRACE_ICE(("%x, ", eeprom_data[i])); - TRACE_ICE(("<- EEprom\n")); + TRACE_ICE(("<- EEprom\n"));*/ write_ccs_uint8(ice, CCS_SERR_SHADOW, 0x01); //Write all configurations register from EEProm - - //Write enable SVID -// (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x42, 2, 0x86); - //Change SVID - ice->info.device_id = eeprom_data[1] << 8 | eeprom_data[0]; - ice->info.vendor_id = eeprom_data[3] << 8 | eeprom_data[2]; + ice->info.device_id = ice->eeprom_data[E2PROM_MAP_SUBVENDOR_HIGH] << 8 | ice->eeprom_data[E2PROM_MAP_SUBVENDOR_LOW]; + ice->info.vendor_id = ice->eeprom_data[E2PROM_MAP_SUBDEVICE_HIGH] << 8 | ice->eeprom_data[E2PROM_MAP_SUBDEVICE_LOW]; ice->product = ice->info.vendor_id << 16 | ice->info.device_id; -// (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x2C, 4, ice->product); + TRACE_ICE(("Product ID : 0x%x\n", ice->product)); - //Write Disable SVID -// (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x42, 2, 0x06); + write_cci_uint8(ice, CCI_GPIO_WRITE_MASK, ice->eeprom_data[E2PROM_MAP_GPIOMASK]); + write_cci_uint8(ice, CCI_GPIO_DATA, ice->eeprom_data[E2PROM_MAP_GPIOSTATE]); + write_cci_uint8(ice, CCI_GPIO_DIRECTION_CONTROL, ice->eeprom_data[E2PROM_MAP_GPIODIR]); - TRACE_ICE(("Product ID : 0x%x\n", ice->product)); + TRACE_ICE(("CCI_GPIO_WRITE_MASK : 0x%x\n", ice->eeprom_data[E2PROM_MAP_GPIOMASK])); + TRACE_ICE(("CCI_GPIO_DATA : 0x%x\n", ice->eeprom_data[E2PROM_MAP_GPIOSTATE])); + TRACE_ICE(("CCI_GPIO_DIRECTION_CONTROL : 0x%x\n", ice->eeprom_data[E2PROM_MAP_GPIODIR])); - (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x60, 1, eeprom_data[6]); - (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x61, 1, eeprom_data[7]); - (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x62, 1, eeprom_data[8]); - (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x63, 1, eeprom_data[9]); - write_cci_uint8(ice, CCI_GPIO_WRITE_MASK, eeprom_data[10]); - write_cci_uint8(ice, CCI_GPIO_DATA, eeprom_data[11]); - write_cci_uint8(ice, CCI_GPIO_DIRECTION_CONTROL, eeprom_data[12]); - write_cci_uint8(ice, CCI_CONS_POWER_DOWN, eeprom_data[13]); - write_cci_uint8(ice, CCI_MULTI_POWER_DOWN, eeprom_data[14]); + //Write Configuration in the PCI configuration Register + (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x60, 1, ice->eeprom_data[E2PROM_MAP_CONFIG]); + (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x61, 1, ice->eeprom_data[E2PROM_MAP_ACL]); + (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x62, 1, ice->eeprom_data[E2PROM_MAP_I2S]); + (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x63, 1, ice->eeprom_data[E2PROM_MAP_SPDIF]); - ice->nb_MPU401 = ((eeprom_data[6] & 0x20) >> 5) + 1; - ice->nb_ADC = (((eeprom_data[6] & 0x0C) >> 2) + 1 ) * 2; - ice->nb_DAC = ((eeprom_data[6] & 0x03) + 1) * 2; - ice->spdif_config = eeprom_data[9] & 0x03; + TRACE_ICE(("E2PROM_MAP_CONFIG : 0x%x\n", ice->eeprom_data[E2PROM_MAP_CONFIG])); + reg8 = ice->eeprom_data[E2PROM_MAP_CONFIG]; + //Bits signification for E2PROM_MAP_CONFIG Byte + // + // 8 7 6 5 4 3 2 1 0 + // |-D-|-C-|---B---|---A--- + // + // D : MPU401 number minus 1 + // C : AC'97 + // B : Stereo ADC number minus 1 (=> 1 to 4) + // A : Stereo DAC number minus 1 (=> 1 to 4) + ice->nb_DAC = ((reg8 & 0x03) + 1) * 2; + reg8 >>= 2; + ice->nb_ADC = ((reg8 & 0x03) + 1) * 2; + reg8 >>= 2; + + if ((reg8 & 0x01) != 0) {//Consumer AC'97 Exist + TRACE_ICE(("Consumer AC'97 does exist\n")); + //For now do nothing +/* write_ccs_uint8(ice, CCS_CONS_AC97_COMMAND_STATUS, 0x40); + snooze(10000); + write_ccs_uint8(ice, CCS_CONS_AC97_COMMAND_STATUS, 0x00); + snooze(20000); +*/ } else { + TRACE_ICE(("Consumer AC'97 does NOT exist\n")); + } + reg8 >>= 1; + ice->nb_MPU401 = (reg8 & 0x1) + 1; + for (i = 0; i < ice->nb_MPU401; i++) { sprintf(ice->midi_interf[i].name, "midi/ice1712/%ld/%d", ice - cards + 1, i + 1); names[num_names++] = ice->midi_interf[i].name; } - + + TRACE_ICE(("E2PROM_MAP_SPDIF : 0x%x\n", ice->eeprom_data[E2PROM_MAP_SPDIF])); + ice->spdif_config = ice->eeprom_data[E2PROM_MAP_SPDIF]; + switch (ice->product) { case ICE1712_SUBDEVICE_DELTA66 : @@ -223,20 +244,10 @@ break; } - sprintf(ice->name, "%s/%ld", MODULE_TEST_PATH, ice - cards + 1); + sprintf(ice->name, "%s/%ld", HMULTI_AUDIO_DEV_PATH, ice - cards + 1); names[num_names++] = ice->name; names[num_names] = NULL; - - if ((eeprom_data[6] & 0x10) == 0) {//Consumer AC'97 Exist - TRACE_ICE(("Consumer AC'97 does exist\n")); - write_ccs_uint8(ice, CCS_CONS_AC97_COMMAND_STATUS, 0x40); - snooze(10000); - write_ccs_uint8(ice, CCS_CONS_AC97_COMMAND_STATUS, 0x00); - snooze(20000); - } else { - TRACE_ICE(("Consumer AC'97 does NOT exist\n")); - } - + ice->buffer_ready_sem = create_sem(0, "Buffer Exchange"); // TRACE_ICE(("installing interrupt : %0x\n", ice->irq)); @@ -275,10 +286,21 @@ //Deselect CS write_cci_uint8(ice, CCI_GPIO_DATA, ice->gpio_cs_mask); - //Just to route input to output -// write_mt_uint16(ice, MT_ROUTING_CONTROL_PSDOUT, 0x0101); -// write_mt_uint32(ice, MT_CAPTURED_DATA, 0x0000); + //Just to route all input to all output +// write_mt_uint16(ice, MT_ROUTING_CONTROL_PSDOUT, 0xAAAA); +// write_mt_uint32(ice, MT_CAPTURED_DATA, 0x76543210); + //Just to route SPDIF Input to DAC 0 +// write_mt_uint16(ice, MT_ROUTING_CONTROL_PSDOUT, 0xAAAF); +// write_mt_uint32(ice, MT_CAPTURED_DATA, 0x76543280); + + //Mute all input +/* for (i = 0; i < 20; i++) + { + write_mt_uint8(ice, MT_VOLUME_CONTROL_CHANNEL_INDEX, i); + write_mt_uint16(ice, MT_VOLUME_CONTROL_CHANNEL_INDEX, 0x7F7F); + } +*/ //Unmask Interrupt write_ccs_uint8(ice, CCS_CONTROL_STATUS, 0x41); Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/ice1712.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/ice1712.h 2008-01-12 16:57:50 UTC (rev 23443) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/ice1712.h 2008-01-12 17:05:13 UTC (rev 23444) @@ -13,6 +13,7 @@ #define _ICE1712_H_ #include +#include "hmulti_audio.h" #define DRIVER_NAME "ice1712" #define VERSION "0.3" @@ -87,6 +88,8 @@ uint32 DMA_Path; //PCI_18 uint32 Multi_Track; //PCI_1C + uint8 eeprom_data[32]; + int8 nb_ADC; //Mono Channel int8 nb_DAC; //Mono Channel _spdif_config_ spdif_config; @@ -117,6 +120,7 @@ sem_id buffer_ready_sem; uint8 sampling_rate; //in the format of the register + uint32 lock_source; } ice1712; @@ -124,7 +128,7 @@ extern ice1712 cards[NUM_CARDS]; //??????? -#define GPIO_SPDIF_STATUS 0x02 //Status +#define GPIO_SPDIF_STATUS 0x02 //Status #define GPIO_SPDIF_CCLK 0x04 //data Clock #define GPIO_SPDIF_DOUT 0x08 //data output @@ -213,4 +217,26 @@ } */ +//This map come from ALSA sound drivers +#define E2PROM_MAP_SUBVENDOR_LOW 0x00 +#define E2PROM_MAP_SUBVENDOR_HIGH 0x01 +#define E2PROM_MAP_SUBDEVICE_LOW 0x02 +#define E2PROM_MAP_SUBDEVICE_HIGH 0x03 +#define E2PROM_MAP_SIZE 0x04 +#define E2PROM_MAP_VERSION 0x05 +#define E2PROM_MAP_CONFIG 0x06 +#define E2PROM_MAP_ACL 0x07 +#define E2PROM_MAP_I2S 0x08 +#define E2PROM_MAP_SPDIF 0x09 +#define E2PROM_MAP_GPIOMASK 0x0A +#define E2PROM_MAP_GPIOSTATE 0x0B +#define E2PROM_MAP_GPIODIR 0x0C +#define E2PROM_MAP_AC97MAIN 0x0D +#define E2PROM_MAP_AC97PCM 0x0F +#define E2PROM_MAP_AC97REC 0x11 +#define E2PROM_MAP_AC97REC_SOURCE 0x13 +#define E2PROM_MAP_DAC_ID 0x14 +#define E2PROM_MAP_ADC_ID 0x18 +#define E2PROM_MAP_EXTRA 0x1C + #endif Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/io.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/io.c 2008-01-12 16:57:50 UTC (rev 23443) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/io.c 2008-01-12 17:05:13 UTC (rev 23444) @@ -438,6 +438,7 @@ // drop clock and Data tmp &= ~(ice->digital_codec.clock | ice->digital_codec.data_out); + tmp |= ice->gpio_cs_mask; write_gpio(ice, tmp); snooze(CS84xx_DELAY); Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/multi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/multi.c 2008-01-12 16:57:50 UTC (rev 23443) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/multi.c 2008-01-12 17:05:13 UTC (rev 23444) @@ -17,8 +17,8 @@ #include -#define AUTORIZED_RATE (B_SR_96000 | B_SR_88200 | B_SR_48000 | B_SR_44100) -#define AUTORIZED_SAMPLE_SIZE (B_FMT_24BIT) +#define AUTORIZED_RATE (B_SR_SAME_AS_INPUT | B_SR_IS_GLOBAL | B_SR_96000 | B_SR_88200 | B_SR_48000 | B_SR_44100) +#define AUTORIZED_SAMPLE_SIZE (B_FMT_32BIT) static void start_DMA(ice1712 *card) @@ -30,7 +30,7 @@ write_mt_uint32(card, MT_PROF_PB_DMA_BASE_ADDRESS, (uint32)card->phys_addr_pb); write_mt_uint16(card, MT_PROF_PB_DMA_COUNT_ADDRESS, (size * SWAPPING_BUFFERS) - 1); //We want interrupt only from playback - write_mt_uint16(card, MT_PROF_PB_DMA_TERM_COUNT, size - 1/*0*/); + write_mt_uint16(card, MT_PROF_PB_DMA_TERM_COUNT, size - 1); TRACE_ICE(("SIZE DMA PLAYBACK %#x\n", size)); size = card->input_buffer_size * MAX_ADC; @@ -38,7 +38,7 @@ write_mt_uint32(card, MT_PROF_REC_DMA_BASE_ADDRESS, (uint32)card->phys_addr_rec); write_mt_uint16(card, MT_PROF_REC_DMA_COUNT_ADDRESS, (size * SWAPPING_BUFFERS) - 1); //We do not want any interrupt from the record - write_mt_uint16(card, MT_PROF_REC_DMA_TERM_COUNT, /*size - 1*/0); + write_mt_uint16(card, MT_PROF_REC_DMA_TERM_COUNT, 0); TRACE_ICE(("SIZE DMA RECORD %#x\n", size)); //Enable output AND Input from Analog CODEC @@ -75,7 +75,7 @@ case ICE1712_SUBDEVICE_AUDIOPHILE_2496 : spdif_write(card, CS84xx_SERIAL_INPUT_FORMAT_REG, 0x85); spdif_write(card, CS84xx_SERIAL_OUTPUT_FORMAT_REG, 0x85); - spdif_write(card, CS84xx_SERIAL_OUTPUT_FORMAT_REG, 0x41); +// spdif_write(card, CS84xx_SERIAL_OUTPUT_FORMAT_REG, 0x41); break; case ICE1712_SUBDEVICE_DELTA410 : break; @@ -91,11 +91,10 @@ break; } - card->buffer = 0; + card->buffer = 1; write_mt_uint8(card, MT_PROF_PB_CONTROL, 5); } - status_t ice1712_get_description(ice1712 *card, multi_description *data) { @@ -136,7 +135,7 @@ break; } - strncpy(data->vendor_info, "Jerome Leveque", 32); + strncpy(data->vendor_info, "J. H Leveque", 32); data->output_channel_count = card->total_output_channels; data->input_channel_count = card->total_input_channels; @@ -144,6 +143,7 @@ data->input_bus_channel_count = 0; data->aux_bus_channel_count = 0; + TRACE_ICE(("request_channel_count = %d\n", data->request_channel_count)); if (data->request_channel_count >= (card->total_output_channels + card->total_input_channels)) { for (i = 0; i < card->nb_DAC; i++) { @@ -151,7 +151,7 @@ data->channels[chan].channel_id = chan; data->channels[chan].kind = B_MULTI_OUTPUT_CHANNEL; data->channels[chan].designations = B_CHANNEL_STEREO_BUS | \ - (i & 1) ? B_CHANNEL_LEFT : B_CHANNEL_RIGHT; + ((i & 1) == 0) ? B_CHANNEL_LEFT : B_CHANNEL_RIGHT; data->channels[chan].connectors = 0; chan++; } @@ -175,7 +175,7 @@ data->channels[chan].channel_id = chan; data->channels[chan].kind = B_MULTI_INPUT_CHANNEL; data->channels[chan].designations = B_CHANNEL_STEREO_BUS | \ - (i & 1) ? B_CHANNEL_LEFT : B_CHANNEL_RIGHT; + ((i & 1) == 0) ? B_CHANNEL_LEFT : B_CHANNEL_RIGHT; data->channels[chan].connectors = 0; chan++; } @@ -217,7 +217,7 @@ data->max_cvsr_rate = 96000; data->output_formats = data->input_formats = AUTORIZED_SAMPLE_SIZE; - data->lock_sources = B_MULTI_LOCK_INTERNAL /*| B_MULTI_LOCK_SPDIF*/; + data->lock_sources = B_MULTI_LOCK_INTERNAL | B_MULTI_LOCK_SPDIF; data->timecode_sources = 0; data->interface_flags = B_MULTI_INTERFACE_PLAYBACK | B_MULTI_INTERFACE_RECORD; data->start_latency = 0; @@ -262,6 +262,8 @@ else write_mt_uint8(card, MT_SAMPLING_RATE_SELECT, card->sampling_rate); + card->lock_source = data->lock_source; + return B_OK; } @@ -310,7 +312,8 @@ TRACE_ICE(("Input Sampling Rate = %#x\n", data->input.rate)); TRACE_ICE(("Output Sampling Rate = %#x\n", data->output.rate)); - if (data->input.rate == data->output.rate) { + if ((data->input.rate == data->output.rate) && + (card->lock_source == B_MULTI_LOCK_INTERNAL)) { switch (data->input.rate) { case B_SR_96000 : @@ -335,14 +338,14 @@ status_t -ice1712_get_mix(ice1712 *card, multi_mix_value_info *MMVI) +ice1712_get_mix(ice1712 *card, multi_mix_value_info *data) {//Not Implemented return B_ERROR; } status_t -ice1712_set_mix(ice1712 *card, multi_mix_value_info *MMVI) +ice1712_set_mix(ice1712 *card, multi_mix_value_info *data) {//Not Implemented return B_ERROR; } @@ -355,13 +358,73 @@ } -status_t -ice1712_list_mix_controls(ice1712 *card, multi_mix_control_info *MMCI) -{//Not Implemented - return B_ERROR; +#define MULTI_AUDIO_BASE_ID 1024 +#define MULTI_AUDIO_MASTER_ID 0 + +#ifndef B_MULTI_MIX_GROUP +#define B_MULTI_MIX_GROUP 10 +#endif + +#ifndef S_null +#define S_null 10 +#endif + +#ifndef S_STEREO_MIX +#define S_STEREO_MIX 10 +#endif + +static int32 +create_group_control(multi_mix_control *multi, int32 idx, int32 parent, int32 string, const char* name) +{ + multi->id = MULTI_AUDIO_BASE_ID + idx; + multi->master = parent; + multi->flags = B_MULTI_MIX_GROUP; + multi->master = MULTI_AUDIO_MASTER_ID; +// multi->string = string; + + if (name != NULL) + strcpy(multi->name, name); + + return multi->id; } +static int32 +create_slider_control(multi_mix_control *multi, int32 idx, int32 parent, int32 string, const char* name) +{ + multi->id = MULTI_AUDIO_BASE_ID + idx; + multi->master = parent; + multi->flags = B_MULTI_MIX_GAIN; + multi->master = MULTI_AUDIO_MASTER_ID + 1; +// multi->string = string; + multi->u.gain.min_gain = -144.0; + multi->u.gain.max_gain = 0.0; + multi->u.gain.granularity = 1.5; + + if (name != NULL) + strcpy(multi->name, name); + + return multi->id; +} + + +status_t +ice1712_list_mix_controls(ice1712 *card, multi_mix_control_info *data) +{ + int32 parent; + + TRACE_ICE(("count = %d\n", data->control_count)); + parent = create_group_control (data->controls + 0, 0, 0, S_null, "Playback"); + create_slider_control (data->controls + 1, 1, parent, S_STEREO_MIX, "Master Output"); + + parent = create_group_control (data->controls + 2, 2, 0, S_null, "Record"); + create_slider_control (data->controls + 3, 3, parent, S_STEREO_MIX, "Master Input"); + data->control_count = 4; + + return B_OK; +} + + status_t ice1712_list_mix_connections(ice1712 *card, multi_mix_connection_info *data) {//Not Implemented @@ -382,13 +445,13 @@ TRACE_ICE(("request_record_channels = %#x\n", data->request_record_channels)); TRACE_ICE(("request_record_buffer_size = %#x\n", data->request_record_buffer_size)); - // MIN_BUFFER_FRAMES <= requested value are <= MAX_BUFFER_FRAMES + // MIN_BUFFER_FRAMES <= requested value <= MAX_BUFFER_FRAMES card->output_buffer_size = data->request_playback_buffer_size <= MAX_BUFFER_FRAMES ? \ data->request_playback_buffer_size >= MIN_BUFFER_FRAMES ? \ data->request_playback_buffer_size : MIN_BUFFER_FRAMES \ : MAX_BUFFER_FRAMES; - // MIN_BUFFER_FRAMES <= requested value are <= MAX_BUFFER_FRAMES + // MIN_BUFFER_FRAMES <= requested value <= MAX_BUFFER_FRAMES card->input_buffer_size = data->request_record_buffer_size <= MAX_BUFFER_FRAMES ? \ data->request_record_buffer_size >= MIN_BUFFER_FRAMES ? \ data->request_record_buffer_size : MIN_BUFFER_FRAMES \ @@ -490,6 +553,7 @@ data->return_record_buffers = SWAPPING_BUFFERS; data->return_record_channels = card->total_input_channels; + data->return_record_channels = chan_i; data->return_record_buffer_size = card->input_buffer_size; TRACE_ICE(("return_record_buffers = %#x\n", data->return_record_buffers)); @@ -521,12 +585,12 @@ // do playback data->played_real_time = card->played_time; data->played_frames_count += card->output_buffer_size; - data->playback_buffer_cycle = (card->buffer - 1) & 0x1; //Buffer TO fill + data->playback_buffer_cycle = (card->buffer/* - 1*/) & 0x1; //Buffer TO fill // do record data->recorded_real_time = card->played_time; data->recorded_frames_count += card->input_buffer_size; - data->record_buffer_cycle = (card->buffer - 1) & 0x1; //Buffer filled + data->record_buffer_cycle = (card->buffer/* - 1*/) & 0x1; //Buffer filled data->flags = B_MULTI_BUFFER_PLAYBACK | B_MULTI_BUFFER_RECORD; @@ -552,12 +616,16 @@ case B_TIMED_OUT : TRACE_ICE(("B_TIMED_OUT\n")); start_DMA(card); + cpu_status = lock(); - data->record_buffer_cycle = 0; - data->playback_buffer_cycle = 1; - data->played_frames_count += card->output_buffer_size; - data->recorded_frames_count += card->input_buffer_size; + data->played_real_time = card->played_time; + data->playback_buffer_cycle = 0; + data->played_frames_count += card->output_buffer_size; + + data->recorded_real_time = card->played_time; + data->record_buffer_cycle = 0; + data->recorded_frames_count += card->input_buffer_size; data->flags = B_MULTI_BUFFER_PLAYBACK | B_MULTI_BUFFER_RECORD; unlock(cpu_status); @@ -568,12 +636,20 @@ break; } +/* if ((card->buffer % 500) == 0) + { + uint8 reg8, reg8_dir; + reg8 = read_gpio(card); + reg8_dir = read_cci_uint8(card, CCI_GPIO_DIRECTION_CONTROL); + TRACE_ICE(("B_NO_ERROR buffer = %d : GPIO = %d (%d)\n", card->buffer, reg8, reg8_dir)); + } +*/ return B_OK; } status_t ice1712_buffer_force_stop(ice1712 *card) { -// write_mt_uint8(card, MT_PROF_PB_CONTROL, 0); + write_mt_uint8(card, MT_PROF_PB_CONTROL, 0); return B_OK; } Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/multi.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/multi.h 2008-01-12 16:57:50 UTC (rev 23443) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/multi.h 2008-01-12 17:05:13 UTC (rev 23444) @@ -9,7 +9,6 @@ * Distributed under the terms of the MIT license. */ -#include "multi_audio.h" #include "ice1712.h" status_t ice1712_get_description(ice1712 *card, multi_description *data); @@ -17,10 +16,10 @@ status_t ice1712_set_enabled_channels(ice1712 *card, multi_channel_enable *data); status_t ice1712_get_global_format(ice1712 *card, multi_format_info *data); status_t ice1712_set_global_format(ice1712 *card, multi_format_info *data); -status_t ice1712_get_mix(ice1712 *card, multi_mix_value_info *MMVI); -status_t ice1712_set_mix(ice1712 *card, multi_mix_value_info *MMVI); +status_t ice1712_get_mix(ice1712 *card, multi_mix_value_info *data); +status_t ice1712_set_mix(ice1712 *card, multi_mix_value_info *data); status_t ice1712_list_mix_channels(ice1712 *card, multi_mix_channel_info *data); -status_t ice1712_list_mix_controls(ice1712 *card, multi_mix_control_info *MMCI); +status_t ice1712_list_mix_controls(ice1712 *card, multi_mix_control_info *data); status_t ice1712_list_mix_connections(ice1712 *card, multi_mix_connection_info *data); status_t ice1712_get_buffers(ice1712 *card, multi_buffer_list *data); status_t ice1712_buffer_exchange(ice1712 *card, multi_buffer_info *data); From axeld at mail.berlios.de Sat Jan 12 18:36:12 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 12 Jan 2008 18:36:12 +0100 Subject: [Haiku-commits] r23445 - haiku/trunk/src/system/kernel/fs Message-ID: <200801121736.m0CHaCBp013935@sheep.berlios.de> Author: axeld Date: 2008-01-12 18:36:10 +0100 (Sat, 12 Jan 2008) New Revision: 23445 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23445&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Fixed two bugs in the vnode disconnecting code found by bonefish+mmlr: * vfs_disconnect_vnode() did not put away its vnode reference. * disconnect_mount_or_vnode_fds() did always throw the current working directory of all apps on the same mount away, even if only a specific vnode should have been disconnected. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-01-12 17:05:13 UTC (rev 23444) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-01-12 17:36:10 UTC (rev 23445) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2002-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -1371,7 +1371,9 @@ context->io_mutex.holder = thread_get_current_thread_id(); - if (context->cwd != NULL && context->cwd->mount == mount) { + if (context->cwd != NULL && context->cwd->mount == mount + && (vnodeToDisconnect == NULL + || vnodeToDisconnect == context->cwd)) { put_vnode(context->cwd); // Note: We're only accessing the pointer, not the vnode itself // in the lines below. @@ -3360,6 +3362,7 @@ return status; disconnect_mount_or_vnode_fds(vnode->mount, vnode); + put_vnode(vnode); return B_OK; } From mmlr at mail.berlios.de Sat Jan 12 18:38:57 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 12 Jan 2008 18:38:57 +0100 Subject: [Haiku-commits] r23446 - haiku/trunk/src/system/kernel/fs Message-ID: <200801121738.m0CHcvrc018125@sheep.berlios.de> Author: mmlr Date: 2008-01-12 18:38:56 +0100 (Sat, 12 Jan 2008) New Revision: 23446 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23446&view=rev Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp Log: Remove unnecessary remove_vnode() in devfs_unpublish_device() done already in unpublish_node() Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/devfs.cpp 2008-01-12 17:36:10 UTC (rev 23445) +++ haiku/trunk/src/system/kernel/fs/devfs.cpp 2008-01-12 17:38:56 UTC (rev 23446) @@ -2560,7 +2560,6 @@ if (status == B_OK && disconnect) vfs_disconnect_vnode(sDeviceFileSystem->id, node->id); - remove_vnode(sDeviceFileSystem->id, node->id); put_vnode(sDeviceFileSystem->id, node->id); return status; } From axeld at mail.berlios.de Sat Jan 12 19:41:36 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 12 Jan 2008 19:41:36 +0100 Subject: [Haiku-commits] r23447 - in haiku/trunk: headers/private/kernel src/system/kernel/debug Message-ID: <200801121841.m0CIfaMX026056@sheep.berlios.de> Author: axeld Date: 2008-01-12 19:41:35 +0100 (Sat, 12 Jan 2008) New Revision: 23447 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23447&view=rev Added: haiku/trunk/headers/private/kernel/tracing.h haiku/trunk/src/system/kernel/debug/tracing.cpp Modified: haiku/trunk/src/system/kernel/debug/Jamfile haiku/trunk/src/system/kernel/debug/debug.c Log: bonefish+axeld: * Implemented an optional tracing layer that can be used in the kernel. Nice to use if you don't have serial output or need something that doesn't slow down the system as much. Added: haiku/trunk/headers/private/kernel/tracing.h =================================================================== --- haiku/trunk/headers/private/kernel/tracing.h 2008-01-12 17:38:56 UTC (rev 23446) +++ haiku/trunk/headers/private/kernel/tracing.h 2008-01-12 18:41:35 UTC (rev 23447) @@ -0,0 +1,42 @@ +#ifndef KERNEL_UTIL_TRACING_H +#define KERNEL_UTIL_TRACING_H + + +#include + + +#define ENABLE_TRACING 0 +#define MAX_TRACE_SIZE 1024 * 1024 + +struct trace_entry { + uint16 size; + uint16 flags; +}; + +#ifdef __cplusplus + +#include + +class TraceEntry : trace_entry { + public: + TraceEntry(); + virtual ~TraceEntry(); + + virtual void Dump(); + + size_t Size() const { return size; } + uint16 Flags() const { return flags; } + + void Initialized(); + + void* operator new(size_t size); +}; + +#endif // __cplusplus + +#ifdef __cplusplus +extern "C" +#endif +status_t tracing_init(void); + +#endif /* KERNEL_UTIL_TRACING_H */ Modified: haiku/trunk/src/system/kernel/debug/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/debug/Jamfile 2008-01-12 17:38:56 UTC (rev 23446) +++ haiku/trunk/src/system/kernel/debug/Jamfile 2008-01-12 18:41:35 UTC (rev 23447) @@ -7,6 +7,7 @@ debug.c frame_buffer_console.cpp gdb.c + tracing.cpp user_debugger.cpp : $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused Modified: haiku/trunk/src/system/kernel/debug/debug.c =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.c 2008-01-12 17:38:56 UTC (rev 23446) +++ haiku/trunk/src/system/kernel/debug/debug.c 2008-01-12 18:41:35 UTC (rev 23447) @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -722,6 +723,7 @@ frame_buffer_console_init(args); arch_debug_console_init_settings(args); + tracing_init(); // get debug settings handle = load_driver_settings("kernel"); Added: haiku/trunk/src/system/kernel/debug/tracing.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/tracing.cpp 2008-01-12 17:38:56 UTC (rev 23446) +++ haiku/trunk/src/system/kernel/debug/tracing.cpp 2008-01-12 18:41:35 UTC (rev 23447) @@ -0,0 +1,203 @@ +#include + +#include + +#include + + +#if ENABLE_TRACING + +enum { + WRAP_ENTRY = 0x01, + ENTRY_INITIALIZED = 0x02 +}; + +static const size_t kBufferSize = MAX_TRACE_SIZE / 4 - 1; + +static trace_entry* sBuffer; +static trace_entry* sBufferStart; +static trace_entry* sBufferEnd; +static uint32 sEntries; +static spinlock sLock; + + +static trace_entry* +next_entry(trace_entry* entry) +{ + entry += entry->size >> 2; + if ((entry->flags & WRAP_ENTRY) != 0) + entry = sBuffer; + + if (entry == sBufferEnd) + return NULL; + + return entry; +} + + +static void +make_space(size_t size) +{ + if (sBufferEnd + size / 4 > sBuffer + kBufferSize - 1) { + sBufferEnd->size = 0; + sBufferEnd->flags = WRAP_ENTRY; + sBufferEnd = sBuffer; + } + + int32 diff = sBufferStart - sBufferEnd; + if (diff < 0) + sBufferEnd = sBuffer; + else + size -= diff; + + while (true) { + uint16 skip = sBufferStart->size; + sBufferStart = next_entry(sBufferStart); + if (sBufferStart == NULL) + sBufferStart = sBuffer; + sEntries--; + + if (size <= skip) + break; + + size -= skip; + } +} + + +#endif // ENABLE_TRACING + + +// #pragma mark - + + +TraceEntry::TraceEntry() +{ +} + + +TraceEntry::~TraceEntry() +{ +} + + +void +TraceEntry::Dump() +{ +#if ENABLE_TRACING + // to be overloaded by subclasses + kprintf("ENTRY %p\n", this); +#endif +} + + +void +TraceEntry::Initialized() +{ +#if ENABLE_TRACING + flags |= ENTRY_INITIALIZED; +#endif +} + + +void* +TraceEntry::operator new(size_t size) throw() +{ +#if ENABLE_TRACING + if (sBuffer == NULL) + return NULL; + + InterruptsSpinLocker _(sLock); + + size = (size + 3) & ~3; + + if (sBufferStart < sBufferEnd || sEntries == 0) { + // the buffer ahead of us is still empty + uint32 space = (sBuffer + kBufferSize - sBufferEnd) * 4; + if (space < size) + make_space(size); + } else { + // we need to overwrite existing entries + make_space(size); + } + + trace_entry* entry = sBufferEnd; + entry->size = size; + entry->flags = 0; + sBufferEnd += size >> 2; + sEntries++; + return entry; +#else // !ENABLE_TRACING + return NULL; +#endif +} + + +// #pragma mark - + + +#if ENABLE_TRACING + + +int +dump_tracing(int argc, char** argv) +{ + int32 count = 30; + int32 start = sEntries - count; + + if (argc == 2) { + count = strtol(argv[1], NULL, 0); + } else if (argc == 3) { + start = strtol(argv[1], NULL, 0); + count = strtol(argv[2], NULL, 0); + } else if (argc > 3) { + kprintf("usage: %s [start] [count]\n", argv[0]); + return 0; + } + + if (start < 0) + start = 0; + + int32 index = 0; + + for (trace_entry* current = sBufferStart; current != NULL; + current = next_entry(current), index++) { + if (index < start) + continue; + if (index > start + count) + break; + + if ((current->flags & ENTRY_INITIALIZED) != 0) + ((TraceEntry*)current)->Dump(); + else + kprintf("** uninitialized entry **\n"); + } + + return 0; +} + + +#endif // ENABLE_TRACING + + +extern "C" status_t +tracing_init(void) +{ +#if ENABLE_TRACING + area_id area = create_area("tracing log", (void**)&sBuffer, + B_ANY_KERNEL_ADDRESS, MAX_TRACE_SIZE, B_FULL_LOCK, + B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); + if (area < B_OK) { + panic("OH"); + return area; + } + + sBufferStart = sBuffer; + sBufferEnd = sBuffer; + + add_debugger_command("traced", &dump_tracing, + "Dump recorded trace entries"); +#endif // ENABLE_TRACING + return B_OK; +} + From marcusoverhagen at mail.berlios.de Sat Jan 12 22:58:33 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 12 Jan 2008 22:58:33 +0100 Subject: [Haiku-commits] r23448 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801122158.m0CLwXIA010375@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-12 22:58:33 +0100 (Sat, 12 Jan 2008) New Revision: 23448 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23448&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c Log: improved PIO transfer speed and system responsiveness. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-12 18:41:35 UTC (rev 23447) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-12 21:58:33 UTC (rev 23448) @@ -110,10 +110,14 @@ if (elapsedTime > timeout) return B_TIMED_OUT; - if (elapsedTime < 4000) + // The device may be ready almost immediatelly. If it isn't, + // poll often during the first 20ms, otherwise poll lazyly. + if (elapsedTime < 500) spin(1); + else if (elapsedTime < 20000) + snooze(1000); else - snooze(4000); + snooze(50000); } } @@ -149,16 +153,6 @@ return ata_wait(bus, 0, ide_status_bsy | ide_status_drq, 0, 20000); } -/* -// busy wait for device beeing ready, -// using the timeout set by the previous ata_send_command -status_t -ata_pio_wait_drdy(ide_device_info *device) -{ - ASSERT(device->bus->state == ata_state_pio); - return ata_wait(device->bus, ide_status_drdy, ide_status_bsy, 0, device->pio_timeout); -} -*/ status_t ata_send_command(ide_device_info *device, ata_request *request, ata_flags flags, bigtime_t timeout) @@ -170,6 +164,7 @@ ASSERT((flags & ATA_DMA_TRANSFER) == 0); // XXX only pio for now +/* FLOW("ata_send_command: %d:%d, request %p, ccb %p, tf %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n", device->target_id, device->is_device1, request, request ? request->ccb : NULL, @@ -177,6 +172,7 @@ device->tf.raw.r[3], device->tf.raw.r[4], device->tf.raw.r[5], device->tf.raw.r[6], device->tf.raw.r[7], device->tf.raw.r[8], device->tf.raw.r[9], device->tf.raw.r[10], device->tf.raw.r[11]); +*/ // disable Interrupts for PIO transfers if ((flags & ATA_DMA_TRANSFER) == 0) { Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-12 18:41:35 UTC (rev 23447) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-12 21:58:33 UTC (rev 23448) @@ -160,8 +160,12 @@ dprintf("ATA: scan_device\n"); if (ata_identify_device(device, isAtapi) != B_OK) { - dprintf("ATA: couldn't read infoblock for device %p\n", device); - return B_ERROR; + isAtapi = !isAtapi; + dprintf("ATA: scan_device: retrying identify for different device type (atapi=%d)\n", isAtapi); + if (ata_identify_device(device, isAtapi) != B_OK) { + dprintf("ATA: couldn't read infoblock for device %p\n", device); + return B_ERROR; + } } fix_infoblock_endian(device); From mmu_man at mail.berlios.de Sat Jan 12 23:12:21 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 12 Jan 2008 23:12:21 +0100 Subject: [Haiku-commits] r23449 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801122212.m0CMCLsM012448@sheep.berlios.de> Author: mmu_man Date: 2008-01-12 23:12:20 +0100 (Sat, 12 Jan 2008) New Revision: 23449 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23449&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp haiku/trunk/src/system/boot/platform/atari_m68k/cpu.h Log: CPU init stuff. TODO: check for LPSTOP (040), and cpu model (must be >= 020). Added: haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp 2008-01-12 21:58:33 UTC (rev 23448) +++ haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp 2008-01-12 22:12:20 UTC (rev 23449) @@ -0,0 +1,73 @@ +/* + * Copyright 2004-2005, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + * + * calculate_cpu_conversion_factor() was written by Travis Geiselbrecht and + * licensed under the NewOS license. + */ + + +#include "cpu.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +//#define TRACE_CPU +#ifdef TRACE_CPU +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + +bool gCpuHasLPSTOP = false; + +static status_t +check_cpu_features() +{ +#warning M68K: check for LPSTOP + if (false) + gCpuHasLPSTOP = true; + +#warning M68K: check for >= 020 + + return B_OK; +} + + +// #pragma mark - + + +extern "C" void +spin(bigtime_t microseconds) +{ + bigtime_t time = system_time(); + if (gCpuHasLPSTOP) { + while ((system_time() - time) < microseconds) + asm volatile ("lpstop;"); + } else { + while ((system_time() - time) < microseconds) + asm volatile ("nop;"); + } +} + + +extern "C" void +cpu_init() +{ + if (check_cpu_features() != B_OK) + panic("You need a 68020 or higher in order to boot!\n"); + + gKernelArgs.num_cpus = 1; + // this will eventually be corrected later on + // ...or not! +} + Added: haiku/trunk/src/system/boot/platform/atari_m68k/cpu.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/cpu.h 2008-01-12 21:58:33 UTC (rev 23448) +++ haiku/trunk/src/system/boot/platform/atari_m68k/cpu.h 2008-01-12 22:12:20 UTC (rev 23449) @@ -0,0 +1,22 @@ +/* + * Copyright 2004-2005, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef CPU_H +#define CPU_H + + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +extern void cpu_init(void); + +#ifdef __cplusplus +} +#endif + +#endif /* CPU_H */ From axeld at mail.berlios.de Sat Jan 12 23:49:04 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 12 Jan 2008 23:49:04 +0100 Subject: [Haiku-commits] r23450 - haiku/trunk/src/system/kernel/vm Message-ID: <200801122249.m0CMn4uZ015869@sheep.berlios.de> Author: axeld Date: 2008-01-12 23:49:03 +0100 (Sat, 12 Jan 2008) New Revision: 23450 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23450&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp Log: Added TODO comment about a possible deadlock Marcus just found :-) Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-01-12 22:12:20 UTC (rev 23449) +++ haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-01-12 22:49:03 UTC (rev 23450) @@ -1016,6 +1016,9 @@ busyConditions[i].Unpublish(); mutex_unlock(&cache->lock); + // TODO: we need to release the cache references after all + // pages are made unbusy again - otherwise releasing a vnode + // could deadlock. if (cache->store->ops->release_ref != NULL) cache->store->ops->release_ref(cache->store); vm_cache_release_ref(cache); From mmu_man at mail.berlios.de Sat Jan 12 23:51:58 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 12 Jan 2008 23:51:58 +0100 Subject: [Haiku-commits] r23451 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801122251.m0CMpwIR016210@sheep.berlios.de> Author: mmu_man Date: 2008-01-12 23:51:58 +0100 (Sat, 12 Jan 2008) New Revision: 23451 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23451&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp Log: lpstop is 060 only so gas complains. comment for now. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp 2008-01-12 22:49:03 UTC (rev 23450) +++ haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp 2008-01-12 22:51:58 UTC (rev 23451) @@ -52,7 +52,7 @@ bigtime_t time = system_time(); if (gCpuHasLPSTOP) { while ((system_time() - time) < microseconds) - asm volatile ("lpstop;"); + asm volatile ("nop;");//asm volatile ("lpstop;"); } else { while ((system_time() - time) < microseconds) asm volatile ("nop;"); From mmu_man at mail.berlios.de Sat Jan 12 23:54:40 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 12 Jan 2008 23:54:40 +0100 Subject: [Haiku-commits] r23452 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801122254.m0CMsedq016352@sheep.berlios.de> Author: mmu_man Date: 2008-01-12 23:54:40 +0100 (Sat, 12 Jan 2008) New Revision: 23452 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23452&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/start.c Log: Comment out x86 asm Modified: haiku/trunk/src/system/boot/platform/atari_m68k/start.c =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/start.c 2008-01-12 22:51:58 UTC (rev 23451) +++ haiku/trunk/src/system/boot/platform/atari_m68k/start.c 2008-01-12 22:54:40 UTC (rev 23452) @@ -79,6 +79,7 @@ dprintf("kernel entry at %lx\n", gKernelArgs.kernel_image.elf_header.e_entry); +#if 0 asm("movl %0, %%eax; " // move stack out of way "movl %%eax, %%esp; " : : "m" (stackTop)); @@ -88,6 +89,7 @@ "pushl %1; " // this is the start address "ret; " // jump. : : "g" (args), "g" (gKernelArgs.kernel_image.elf_header.e_entry)); +#endif panic("kernel returned!\n"); } @@ -107,8 +109,8 @@ { stage2_args args; - asm("cld"); // Ain't nothing but a GCC thang. - asm("fninit"); // initialize floating point unit + //asm("cld"); // Ain't nothing but a GCC thang. + //asm("fninit"); // initialize floating point unit clear_bss(); call_ctors(); From mmu_man at mail.berlios.de Sun Jan 13 00:11:04 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 00:11:04 +0100 Subject: [Haiku-commits] r23453 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801122311.m0CNB41l017885@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 00:11:03 +0100 (Sun, 13 Jan 2008) New Revision: 23453 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23453&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: * Add function to access the Cookie Jar. * remove unneeded stuff. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-12 22:54:40 UTC (rev 23452) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-12 23:11:03 UTC (rev 23453) @@ -32,7 +32,7 @@ cpu.cpp #smp.cpp #smp_trampoline.S - support.S +# support.S video.cpp #apm.cpp Modified: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp 2008-01-12 22:54:40 UTC (rev 23452) +++ haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp 2008-01-12 23:11:03 UTC (rev 23453) @@ -7,7 +7,6 @@ #include "mmu.h" -#include "bios.h" #include #include Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-12 22:54:40 UTC (rev 23452) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-12 23:11:03 UTC (rev 23453) @@ -142,6 +142,31 @@ extern status_t toserror(int32 err); +/* + * Cookie Jar access + */ + +typedef struct tos_cookie { + uint32 cookie; + enum { + int32 ivalue; + void *pvalue; + } +} tos_cookie; + +#define COOKIE_JAR (*((const tos_cookie **)0x5A0)) + +static inline tos_cookie *tos_find_cookie(uint32 what) +{ + struct c = COOKIE_JAR; + while (c && (c->cookie)) { + if (c->cookie == what) + return c; + c++; + } + return NULL; +} + #endif /* __ASSEMBLER__ */ #ifdef __cplusplus From mmu_man at mail.berlios.de Sun Jan 13 00:16:01 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 00:16:01 +0100 Subject: [Haiku-commits] r23454 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801122316.m0CNG1kq018310@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 00:16:01 +0100 (Sun, 13 Jan 2008) New Revision: 23454 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23454&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: better finish stuff before committing. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-12 23:11:03 UTC (rev 23453) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-12 23:16:01 UTC (rev 23454) @@ -148,17 +148,17 @@ typedef struct tos_cookie { uint32 cookie; - enum { + union { int32 ivalue; void *pvalue; - } + }; } tos_cookie; #define COOKIE_JAR (*((const tos_cookie **)0x5A0)) -static inline tos_cookie *tos_find_cookie(uint32 what) +static inline const tos_cookie *tos_find_cookie(uint32 what) { - struct c = COOKIE_JAR; + const tos_cookie *c = COOKIE_JAR; while (c && (c->cookie)) { if (c->cookie == what) return c; From axeld at mail.berlios.de Sun Jan 13 00:45:12 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Jan 2008 00:45:12 +0100 Subject: [Haiku-commits] r23455 - haiku/trunk/src/system/kernel/fs Message-ID: <200801122345.m0CNjCQB020632@sheep.berlios.de> Author: axeld Date: 2008-01-13 00:45:11 +0100 (Sun, 13 Jan 2008) New Revision: 23455 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23455&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Added the cookie/private_node fields to the mounts/vnodes list in KDL. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-01-12 23:16:01 UTC (rev 23454) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-01-12 23:45:11 UTC (rev 23455) @@ -2379,12 +2379,12 @@ struct hash_iterator iterator; struct fs_mount *mount; - kprintf("address id root covers fs_name\n"); + kprintf("address id root covers cookie fs_name\n"); hash_open(sMountsTable, &iterator); while ((mount = (struct fs_mount *)hash_next(sMountsTable, &iterator)) != NULL) { - kprintf("%p%4ld %p %p %s\n", mount, mount->id, mount->root_vnode, - mount->covers_vnode, mount->fs_name); + kprintf("%p%4ld %p %p %p %s\n", mount, mount->id, mount->root_vnode, + mount->covers_vnode, mount->cookie, mount->fs_name); } hash_close(sMountsTable, &iterator, false); @@ -2446,17 +2446,18 @@ struct hash_iterator iterator; struct vnode *vnode; - kprintf("address dev inode ref cache locking flags\n"); + kprintf("address dev inode ref cache fs-node locking " + "flags\n"); hash_open(sVnodeTable, &iterator); while ((vnode = (struct vnode *)hash_next(sVnodeTable, &iterator)) != NULL) { if (device != -1 && vnode->device != device) continue; - kprintf("%p%4ld%10Ld%5ld %p %p %s%s%s\n", vnode, vnode->device, vnode->id, - vnode->ref_count, vnode->cache, vnode->advisory_locking, - vnode->remove ? "r" : "-", vnode->busy ? "b" : "-", - vnode->unpublished ? "u" : "-"); + kprintf("%p%4ld%10Ld%5ld %p %p %p %s%s%s\n", vnode, vnode->device, + vnode->id, vnode->ref_count, vnode->cache, vnode->private_node, + vnode->advisory_locking, vnode->remove ? "r" : "-", + vnode->busy ? "b" : "-", vnode->unpublished ? "u" : "-"); } hash_close(sVnodeTable, &iterator, false); From colacoder at mail.berlios.de Sun Jan 13 00:48:53 2008 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Sun, 13 Jan 2008 00:48:53 +0100 Subject: [Haiku-commits] r23456 - in haiku/trunk/src/system/kernel: . fs Message-ID: <200801122348.m0CNmrIt025327@sheep.berlios.de> Author: colacoder Date: 2008-01-13 00:48:52 +0100 (Sun, 13 Jan 2008) New Revision: 23456 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23456&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp haiku/trunk/src/system/kernel/team.cpp Log: Fix problem with CLOEXEC also being handled on fork(). For details on expected (BeOS) behaviour, see http://www.freelists.org/archives/openbeos/12-2001/msg00280.html Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-01-12 23:45:11 UTC (rev 23455) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-01-12 23:48:52 UTC (rev 23456) @@ -3501,7 +3501,7 @@ /*! Closes all file descriptors of the specified I/O context that - don't have the O_CLOEXEC flag set. + have the O_CLOEXEC flag set. */ void vfs_exec_io_context(void *_context) @@ -3591,7 +3591,7 @@ for (i = 0; i < tableSize; i++) { struct file_descriptor *descriptor = parentContext->fds[i]; - if (descriptor != NULL && !fd_close_on_exec(parentContext, i)) { + if (descriptor != NULL) { context->fds[i] = descriptor; context->num_used_fds++; atomic_add(&descriptor->ref_count, 1); Modified: haiku/trunk/src/system/kernel/team.cpp =================================================================== --- haiku/trunk/src/system/kernel/team.cpp 2008-01-12 23:45:11 UTC (rev 23455) +++ haiku/trunk/src/system/kernel/team.cpp 2008-01-12 23:48:52 UTC (rev 23456) @@ -931,6 +931,9 @@ goto err2; } + // remove any fds that have the CLOEXEC flag set (emulating BeOS behaviour) + vfs_exec_io_context(team->io_context); + // create an address space for this team status = vm_create_address_space(team->id, USER_BASE, USER_SIZE, false, &team->address_space); From axeld at mail.berlios.de Sun Jan 13 00:53:10 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Jan 2008 00:53:10 +0100 Subject: [Haiku-commits] r23457 - haiku/trunk/src/tools/fs_shell Message-ID: <200801122353.m0CNrA87029048@sheep.berlios.de> Author: axeld Date: 2008-01-13 00:53:09 +0100 (Sun, 13 Jan 2008) New Revision: 23457 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23457&view=rev Modified: haiku/trunk/src/tools/fs_shell/command_cp.cpp Log: Added a progress monitor when copying large files (ie. over 1 MB). Modified: haiku/trunk/src/tools/fs_shell/command_cp.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/command_cp.cpp 2008-01-12 23:48:52 UTC (rev 23456) +++ haiku/trunk/src/tools/fs_shell/command_cp.cpp 2008-01-12 23:53:09 UTC (rev 23457) @@ -883,14 +883,35 @@ copy_file_contents(const char *source, File *sourceFile, const char *target, File *targetFile) { + fssh_off_t chunkSize = (sourceFile->Stat().fssh_st_size / 20) / sCopyBufferSize * sCopyBufferSize; + if (chunkSize == 0) + chunkSize = 1; + + bool progress = sourceFile->Stat().fssh_st_size > 1024 * 1024; + if (progress) { + printf("%s ", strrchr(target, '/') ? strrchr(target, '/') + 1 : target); + fflush(stdout); + } + + fssh_off_t total = 0; fssh_ssize_t bytesRead; while ((bytesRead = sourceFile->Read(sCopyBuffer, sCopyBufferSize)) > 0) { fssh_ssize_t bytesWritten = targetFile->Write(sCopyBuffer, bytesRead); + if (progress && (total % chunkSize) == 0) { + putchar('.'); + fflush(stdout); + } if (bytesWritten < 0) { fprintf(stderr, "Error while writing to file `%s': %s\n", target, fssh_strerror(bytesWritten)); return bytesWritten; } + if (bytesWritten != bytesRead) { + fprintf(stderr, "Could not write all data to file \"%s\".\n", + target); + return FSSH_B_IO_ERROR; + } + total += bytesWritten; } if (bytesRead < 0) { @@ -899,6 +920,9 @@ return bytesRead; } + if (progress) + putchar('\n'); + return FSSH_B_OK; } From mmu_man at mail.berlios.de Sun Jan 13 00:54:04 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 00:54:04 +0100 Subject: [Haiku-commits] r23458 - haiku/trunk/build/jam Message-ID: <200801122354.m0CNs4mX030614@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 00:54:04 +0100 (Sun, 13 Jan 2008) New Revision: 23458 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23458&view=rev Modified: haiku/trunk/build/jam/BuildSetup Log: HAIKU_BOOT_PLATFORM was wrong... Modified: haiku/trunk/build/jam/BuildSetup =================================================================== --- haiku/trunk/build/jam/BuildSetup 2008-01-12 23:53:09 UTC (rev 23457) +++ haiku/trunk/build/jam/BuildSetup 2008-01-12 23:54:04 UTC (rev 23458) @@ -157,7 +157,7 @@ case m68k : { HAIKU_DEFINES += __M68K__ ; - HAIKU_BOOT_PLATFORM = atari ; + HAIKU_BOOT_PLATFORM = atari_m68k ; } case * : Exit "Currently unsupported target CPU:" $(HAIKU_CPU) ; From axeld at mail.berlios.de Sun Jan 13 00:55:54 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Jan 2008 00:55:54 +0100 Subject: [Haiku-commits] r23460 - in haiku/trunk: headers/private/kernel src/system/kernel/debug Message-ID: <200801122355.m0CNtstg032623@sheep.berlios.de> Author: axeld Date: 2008-01-13 00:55:53 +0100 (Sun, 13 Jan 2008) New Revision: 23460 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23460&view=rev Modified: haiku/trunk/headers/private/kernel/tracing.h haiku/trunk/src/system/kernel/debug/tracing.cpp Log: * Added nothrow to the new operator because otherwise the C++ compiler will not accept if the allocator returns NULL and crashes instead (ie. not compiling in tracing would have crashed if some module tried to use it). * Added total entries count to the KDL command output. * Fixed computing the start index of the KDL command. Modified: haiku/trunk/headers/private/kernel/tracing.h =================================================================== --- haiku/trunk/headers/private/kernel/tracing.h 2008-01-12 23:55:53 UTC (rev 23459) +++ haiku/trunk/headers/private/kernel/tracing.h 2008-01-12 23:55:53 UTC (rev 23460) @@ -3,6 +3,7 @@ #include +#include #define ENABLE_TRACING 0 @@ -29,9 +30,31 @@ void Initialized(); - void* operator new(size_t size); + void* operator new(size_t size, const std::nothrow_t&) throw(); }; +class AbstractTraceEntry : public TraceEntry { + public: + AbstractTraceEntry() + : + fThread(find_thread(NULL)), + fTime(system_time()) + { + } + + virtual void Dump() + { + kprintf("[%6ld] %Ld: ", fThread, fTime); + } + + thread_id Thread() const { return fThread; } + bigtime_t Time() const { return fTime; } + + protected: + thread_id fThread; + bigtime_t fTime; +}; + #endif // __cplusplus #ifdef __cplusplus Modified: haiku/trunk/src/system/kernel/debug/tracing.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/tracing.cpp 2008-01-12 23:55:53 UTC (rev 23459) +++ haiku/trunk/src/system/kernel/debug/tracing.cpp 2008-01-12 23:55:53 UTC (rev 23460) @@ -101,7 +101,7 @@ void* -TraceEntry::operator new(size_t size) throw() +TraceEntry::operator new(size_t size, const std::nothrow_t&) throw() { #if ENABLE_TRACING if (sBuffer == NULL) @@ -143,17 +143,19 @@ dump_tracing(int argc, char** argv) { int32 count = 30; + if (argc == 2) + count = strtol(argv[1], NULL, 0); + int32 start = sEntries - count; - if (argc == 2) { - count = strtol(argv[1], NULL, 0); - } else if (argc == 3) { + if (argc == 3) { start = strtol(argv[1], NULL, 0); count = strtol(argv[2], NULL, 0); } else if (argc > 3) { kprintf("usage: %s [start] [count]\n", argv[0]); return 0; } + // TODO: add pattern matching mechanism for the class name if (start < 0) start = 0; @@ -173,6 +175,7 @@ kprintf("** uninitialized entry **\n"); } + kprintf("%ld of %ld entries.\n", count, sEntries); return 0; } From mmu_man at mail.berlios.de Sun Jan 13 00:55:54 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 00:55:54 +0100 Subject: [Haiku-commits] r23459 - haiku/trunk/headers/private/kernel/arch/m68k Message-ID: <200801122355.m0CNtsje032619@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 00:55:53 +0100 (Sun, 13 Jan 2008) New Revision: 23459 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23459&view=rev Modified: haiku/trunk/headers/private/kernel/arch/m68k/arch_kernel_args.h Log: Flag for LPSTOP availability. Modified: haiku/trunk/headers/private/kernel/arch/m68k/arch_kernel_args.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/m68k/arch_kernel_args.h 2008-01-12 23:54:04 UTC (rev 23458) +++ haiku/trunk/headers/private/kernel/arch/m68k/arch_kernel_args.h 2008-01-12 23:55:53 UTC (rev 23459) @@ -19,6 +19,7 @@ int fpu_type; int mmu_type; int platform; + bool has_lpstop; //XXX: use bit flags // architecture specific uint64 cpu_frequency; uint64 bus_frequency; From mmu_man at mail.berlios.de Sun Jan 13 00:56:48 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 00:56:48 +0100 Subject: [Haiku-commits] r23461 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801122356.m0CNumwp000533@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 00:56:47 +0100 (Sun, 13 Jan 2008) New Revision: 23461 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23461&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp Log: We shouldn't trust the TOS, but for now use the cookie jar to find the cpu type and if it has lpstop. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp 2008-01-12 23:55:53 UTC (rev 23460) +++ haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp 2008-01-12 23:56:47 UTC (rev 23461) @@ -8,6 +8,7 @@ #include "cpu.h" +#include "toscalls.h" #include #include @@ -28,17 +29,24 @@ # define TRACE(x) ; #endif -bool gCpuHasLPSTOP = false; - static status_t check_cpu_features() { -#warning M68K: check for LPSTOP - if (false) - gCpuHasLPSTOP = true; +#warning M68K: TODO: probe ourselves, we shouldn't trust the TOS! -#warning M68K: check for >= 020 + const tos_cookie *c = tos_find_cookie('_CPU'); + if (!c) { + panic("can't get a cookie (_CPU)! Mum, I'm hungry!"); + return EINVAL; + } +#warning M68K: check for 020 + mmu + if (c->ivalue < 30/*20*/) + return EINVAL; + + gKernelArgs.arch_args.has_lpstop = (c->ivalue >= 60)?true:false; +#warning M68K: add cpu type to kern args + return B_OK; } @@ -50,13 +58,8 @@ spin(bigtime_t microseconds) { bigtime_t time = system_time(); - if (gCpuHasLPSTOP) { - while ((system_time() - time) < microseconds) - asm volatile ("nop;");//asm volatile ("lpstop;"); - } else { - while ((system_time() - time) < microseconds) - asm volatile ("nop;"); - } + while ((system_time() - time) < microseconds) + asm volatile ("nop;"); } From axeld at mail.berlios.de Sun Jan 13 00:58:57 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Jan 2008 00:58:57 +0100 Subject: [Haiku-commits] r23462 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200801122358.m0CNwv4K002845@sheep.berlios.de> Author: axeld Date: 2008-01-13 00:58:56 +0100 (Sun, 13 Jan 2008) New Revision: 23462 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23462&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp Log: Fixed warnings when building the bfs_shell. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp 2008-01-12 23:56:47 UTC (rev 23461) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp 2008-01-12 23:58:56 UTC (rev 23462) @@ -1002,7 +1002,7 @@ int32 keyIndex = *_keyIndex; // can become less than zero! if (keyIndex > node->NumKeys()) { - FATAL(("key index out of bounds: %ld, num keys: %u\n", keyIndex, + FATAL(("key index out of bounds: %d, num keys: %u\n", (int)keyIndex, node->NumKeys())); return B_BAD_VALUE; } Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-01-12 23:56:47 UTC (rev 23461) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-01-12 23:58:56 UTC (rev 23462) @@ -380,8 +380,8 @@ CachedBlock cached(fVolume); for (int32 index = 0; index < array->CountRuns(); index++) { const block_run &run = array->RunAt(index); - INFORM(("replay block run %lu:%u:%u in log at %Ld!\n", - run.AllocationGroup(), run.Start(), run.Length(), blockNumber)); + INFORM(("replay block run %u:%u:%u in log at %Ld!\n", + (int)run.AllocationGroup(), run.Start(), run.Length(), blockNumber)); off_t offset = fVolume->ToOffset(run); for (int32 i = 0; i < run.Length(); i++) { From marcusoverhagen at mail.berlios.de Sun Jan 13 01:00:58 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 13 Jan 2008 01:00:58 +0100 Subject: [Haiku-commits] r23463 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801130000.m0D00wJf004335@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-13 01:00:58 +0100 (Sun, 13 Jan 2008) New Revision: 23463 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23463&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c Log: Do a shorter wait during identify command, and retry it once to find atapi drives that report a wrong signature Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-12 23:58:56 UTC (rev 23462) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-13 00:00:58 UTC (rev 23463) @@ -1115,7 +1115,7 @@ return B_ERROR; } - if (ata_wait(bus, ide_status_drq, ide_status_bsy, 0, 4000000) != B_OK) { + if (ata_wait(bus, ide_status_drq, ide_status_bsy, 0, 500000) != B_OK) { TRACE("ata_identify_device: wait failed\n"); return B_ERROR; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-12 23:58:56 UTC (rev 23462) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/devices.c 2008-01-13 00:00:58 UTC (rev 23463) @@ -157,16 +157,20 @@ status_t scan_device(ide_device_info *device, bool isAtapi) { + status_t result; dprintf("ATA: scan_device\n"); - if (ata_identify_device(device, isAtapi) != B_OK) { - isAtapi = !isAtapi; - dprintf("ATA: scan_device: retrying identify for different device type (atapi=%d)\n", isAtapi); - if (ata_identify_device(device, isAtapi) != B_OK) { - dprintf("ATA: couldn't read infoblock for device %p\n", device); - return B_ERROR; - } +retry: + result = ata_identify_device(device, isAtapi); + if (result != B_OK && !isAtapi) { + dprintf("ATA: scan_device: possibly ATAPI, retrying identify\n"); + isAtapi = true; + goto retry; } + if (result != B_OK) { + dprintf("ATA: couldn't read infoblock for device %p\n", device); + return B_ERROR; + } fix_infoblock_endian(device); return B_OK; From axeld at mail.berlios.de Sun Jan 13 01:03:54 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Jan 2008 01:03:54 +0100 Subject: [Haiku-commits] r23464 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200801130003.m0D03sJE008719@sheep.berlios.de> Author: axeld Date: 2008-01-13 01:03:53 +0100 (Sun, 13 Jan 2008) New Revision: 23464 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23464&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/system_dependencies.h Log: * Made the additions of the KDL debugger commands independant from the DEBUG macro; they are now added only if BFS_DEBUGGER_COMMANDS is defined (which is now done by default in the Jamfile). * Added "bfs" KDL command which dumps volume information and the super block. * Made use of the new tracing API to trace block and inode actions (and the new AbstractTraceEntry class I forgot to mention in the last commit). Is compiled in only when BFS_TRACING is enabled (defaults to off in the standard builds). Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-01-13 00:00:58 UTC (rev 23463) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-01-13 00:03:53 UTC (rev 23464) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2001-2008, Axel D?rfler, axeld at pinc-software.de. * This file may be used under the terms of the MIT License. */ @@ -36,7 +36,57 @@ // be improved a lot. Furthermore, the allocation policies used here should // have some real world tests. +#if defined(BFS_TRACING) && !defined(BFS_SHELL) && !defined(_BOOT_MODE) +namespace BFSBlockTracing { +class Allocate : public AbstractTraceEntry { + public: + Allocate(block_run run) + : + fRun(run) + { + Initialized(); + } + + virtual void Dump() + { + AbstractTraceEntry::Dump(); + kprintf("alloc %lu.%u.%u\n", fRun.AllocationGroup(), fRun.Start(), + fRun.Length()); + } + + private: + block_run fRun; +}; + +class Free : public AbstractTraceEntry { + public: + Free(block_run run) + : + fRun(run) + { + Initialized(); + } + + virtual void Dump() + { + AbstractTraceEntry::Dump(); + kprintf("free %lu.%u.%u\n", fRun.AllocationGroup(), fRun.Start(), + fRun.Length()); + } + + private: + block_run fRun; +}; + +} // namespace BFSBlockTracing + +# define T(x) new(std::nothrow) BFSBlockTracing::x; +#else +# define T(x) ; +#endif + + struct check_cookie { check_cookie() {} @@ -533,8 +583,8 @@ status_t -BlockAllocator::AllocateBlocks(Transaction &transaction, int32 group, uint16 start, - uint16 maximum, uint16 minimum, block_run &run) +BlockAllocator::AllocateBlocks(Transaction &transaction, int32 group, + uint16 start, uint16 maximum, uint16 minimum, block_run &run) { if (maximum == 0) return B_BAD_VALUE; @@ -631,6 +681,7 @@ // If the value is not correct at mount time, it will be // fixed anyway. + T(Allocate(run)); return B_OK; } @@ -728,6 +779,7 @@ uint16 length = run.Length(); FUNCTION_START(("group = %ld, start = %u, length = %u\n", group, start, length)); + T(Free(run)); // doesn't use Volume::IsValidBlockRun() here because it can check better // against the group size (the last group may have a different length) Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp 2008-01-13 00:00:58 UTC (rev 23463) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp 2008-01-13 00:03:53 UTC (rev 23464) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2001-2008, Axel D?rfler, axeld at pinc-software.de. * Some code is based on work previously done by Marcus Overhagen. * * This file may be used under the terms of the MIT License. @@ -238,13 +238,16 @@ } -// #pragma mark - +// #pragma mark - debugger commands +#ifdef BFS_DEBUGGER_COMMANDS + + static int -debug_inode(int argc, char **argv) +dump_inode(int argc, char **argv) { - if (argc < 2) { + if (argc != 2) { kprintf("usage: bfsinode \n"); return 0; } @@ -256,16 +259,40 @@ } +static int +dump_volume(int argc, char **argv) +{ + if (argc != 2) { + kprintf("usage: bfs \n"); + return 0; + } + + Volume *volume = (Volume *)parse_expression(argv[1]); + + kprintf("root node: %p\n", volume->RootNode()); + kprintf("indices node: %p\n", volume->IndicesNode()); + + dump_super_block(&volume->SuperBlock()); + + return B_OK; +} + + void remove_debugger_commands() { - remove_debugger_command("bfsinode", debug_inode); + remove_debugger_command("bfsinode", dump_inode); + remove_debugger_command("bfs", dump_volume); } void add_debugger_commands() { - add_debugger_command("bfsinode", debug_inode, "dump an Inode object"); + add_debugger_command("bfsinode", dump_inode, "dump an Inode object"); + add_debugger_command("bfs", dump_volume, "dump a BFS volume"); } + +#endif // BFS_DEBUGGER_COMMANDS + Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.h 2008-01-13 00:00:58 UTC (rev 23463) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.h 2008-01-13 00:03:53 UTC (rev 23464) @@ -97,7 +97,8 @@ extern void dump_bplustree_node(const bplustree_node *node, const bplustree_header *header = NULL, Volume *volume = NULL); extern void dump_block(const char *buffer, int size); - +#endif +#ifdef BFS_DEBUGGER_COMMANDS extern void remove_debugger_commands(); extern void add_debugger_commands(); #endif Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2008-01-13 00:00:58 UTC (rev 23463) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2008-01-13 00:03:53 UTC (rev 23464) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2001-2008, Axel D?rfler, axeld at pinc-software.de. * This file may be used under the terms of the MIT License. */ @@ -12,6 +12,106 @@ #include "Index.h" +#if defined(BFS_TRACING) && !defined(BFS_SHELL) && !defined(_BOOT_MODE) +namespace BFSInodeTracing { + +class Create : public AbstractTraceEntry { + public: + Create(Inode* inode, Inode* parent, const char* name, int32 mode, + int openMode, uint32 type) + : + fInode(inode), + fID(inode->ID()), + fParent(parent), + fParentID(parent != NULL ? parent->ID() : 0), + fMode(mode), + fOpenMode(openMode), + fType(type) + { + if (name != NULL) + strlcpy(fName, name, sizeof(fName)); + else + fName[0] = '\0'; + + Initialized(); + } + + virtual void Dump() + { + AbstractTraceEntry::Dump(); + kprintf("CREATE %Ld (%p), parent %Ld (%p), \"%s\", mode %lx, " + "omode %x, type %lx\n", fID, fInode, fParentID, fParent, + fName, fMode, fOpenMode, fType); + } + + private: + Inode* fInode; + ino_t fID; + Inode* fParent; + ino_t fParentID; + char fName[32]; + int32 fMode; + int fOpenMode; + uint32 fType; + +}; + +class Remove : public AbstractTraceEntry { + public: + Remove(Inode* inode, const char* name) + : + fInode(inode), + fID(inode->ID()) + { + strlcpy(fName, name, sizeof(fName)); + Initialized(); + } + + virtual void Dump() + { + AbstractTraceEntry::Dump(); + kprintf("REMOVE %Ld (%p), \"%s\"\n", fID, fInode, fName); + } + + private: + Inode* fInode; + ino_t fID; + char fName[32]; +}; + +class Resize : public AbstractTraceEntry { + public: + Resize(Inode* inode, off_t oldSize, off_t newSize) + : + fInode(inode), + fID(inode->ID()), + fOldSize(oldSize), + fNewSize(newSize) + { + Initialized(); + } + + virtual void Dump() + { + AbstractTraceEntry::Dump(); + kprintf("RESIZE %Ld (%p), %Ld -> %Ld\n", fID, fInode, fOldSize, + fNewSize); + } + + private: + Inode* fInode; + ino_t fID; + off_t fOldSize; + off_t fNewSize; +}; + +} // namespace BFSInodeTracing + +# define T(x) new(std::nothrow) BFSInodeTracing::x; +#else +# define T(x) ; +#endif + class InodeAllocator { public: InodeAllocator(Transaction &transaction); @@ -1943,6 +2043,8 @@ if (size == oldSize) return B_OK; + T(Resize(this, oldSize, size)); + // should the data stream grow or shrink? status_t status; if (size > oldSize) { @@ -2165,6 +2267,8 @@ return B_ENTRY_NOT_FOUND; } + T(Remove(inode, name)); + // Inode::IsContainer() is true also for indices (furthermore, the S_IFDIR // bit is set for indices in BFS, not for attribute directories) - but you // should really be able to do whatever you want with your indices @@ -2326,6 +2430,8 @@ if (status < B_OK) return status; + T(Create(inode, parent, name, mode, openMode, type)); + // Initialize the parts of the bfs_inode structure that // InodeAllocator::New() hasn't touched yet Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Jamfile 2008-01-13 00:00:58 UTC (rev 23463) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Jamfile 2008-01-13 00:03:53 UTC (rev 23464) @@ -10,6 +10,8 @@ # set some additional defines { local defines = + BFS_DEBUGGER_COMMANDS + #BFS_TRACING #BFS_BIG_ENDIAN_ONLY ; Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2008-01-13 00:00:58 UTC (rev 23463) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2008-01-13 00:03:53 UTC (rev 23464) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2001-2008, Axel D?rfler, axeld at pinc-software.de. * This file may be used under the terms of the MIT License. */ @@ -2131,12 +2131,12 @@ { switch (op) { case B_MODULE_INIT: -#ifdef DEBUG +#ifdef BFS_DEBUGGER_COMMANDS add_debugger_commands(); #endif return B_OK; case B_MODULE_UNINIT: -#ifdef DEBUG +#ifdef BFS_DEBUGGER_COMMANDS remove_debugger_commands(); #endif return B_OK; Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/system_dependencies.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/system_dependencies.h 2008-01-13 00:00:58 UTC (rev 23463) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/system_dependencies.h 2008-01-13 00:03:53 UTC (rev 23464) @@ -19,6 +19,8 @@ #include #ifndef _BOOT_MODE +# include + # include # include # include From marcusoverhagen at mail.berlios.de Sun Jan 13 01:04:40 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 13 Jan 2008 01:04:40 +0100 Subject: [Haiku-commits] r23465 - haiku/trunk/headers/os/drivers/bus Message-ID: <200801130004.m0D04e49009787@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-13 01:04:40 +0100 (Sun, 13 Jan 2008) New Revision: 23465 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23465&view=rev Modified: haiku/trunk/headers/os/drivers/bus/SCSI.h Log: fix comments Modified: haiku/trunk/headers/os/drivers/bus/SCSI.h =================================================================== --- haiku/trunk/headers/os/drivers/bus/SCSI.h 2008-01-13 00:03:53 UTC (rev 23464) +++ haiku/trunk/headers/os/drivers/bus/SCSI.h 2008-01-13 00:04:40 UTC (rev 23465) @@ -88,7 +88,7 @@ so ATAPI devices can be used like standard SCSI devices. Further, the SCSI bus manager can emulate auto-sense by executing a REQUEST SENSE if is SCSI_REQ_CMP_ERR and is - SCSI_DEVICE_CHECK_CONDITION when a request is finished. This emulation + SCSI_STATUS_CHECK_CONDITION when a request is finished. This emulation may be enhanced/generalized in the future. */ @@ -449,7 +449,7 @@ // needs some commands emulated bool *no_autosense, // set to true if there is no autosense; // the SCSI bus manager will request sense on - // SCSI_REQ_CMP_ERR/SCSI_DEVICE_CHECK_CONDITION + // SCSI_REQ_CMP_ERR/SCSI_STATUS_CHECK_CONDITION uint32 *max_blocks ); // maximum number of blocks per transfer if > 0; // used for buggy devices that cannot handle // large transfers (read: ATAPI ZIP drives) From axeld at mail.berlios.de Sun Jan 13 01:27:05 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Jan 2008 01:27:05 +0100 Subject: [Haiku-commits] r23466 - haiku/trunk/src/system/kernel/fs Message-ID: <200801130027.m0D0R57b013204@sheep.berlios.de> Author: axeld Date: 2008-01-13 01:27:05 +0100 (Sun, 13 Jan 2008) New Revision: 23466 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23466&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Fix comment. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-01-13 00:04:40 UTC (rev 23465) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-01-13 00:27:05 UTC (rev 23466) @@ -3577,7 +3577,7 @@ return NULL; } - // Copy all parent files which don't have the O_CLOEXEC flag set + // Copy all parent file descriptors if (parentContext) { size_t i; From korli at mail.berlios.de Sun Jan 13 01:58:27 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 13 Jan 2008 01:58:27 +0100 Subject: [Haiku-commits] r23467 - haiku/trunk/src/add-ons/kernel/drivers/bus/firewire Message-ID: <200801130058.m0D0wRfF014606@sheep.berlios.de> Author: korli Date: 2008-01-13 01:58:27 +0100 (Sun, 13 Jan 2008) New Revision: 23467 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23467&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/firewire/fw_raw.c Log: check the allocation of the name list Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/firewire/fw_raw.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/firewire/fw_raw.c 2008-01-13 00:27:05 UTC (rev 23466) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/firewire/fw_raw.c 2008-01-13 00:58:27 UTC (rev 23467) @@ -997,6 +997,10 @@ } devices = malloc(sizeof(char *) * (devices_count+1)); + if (!devices) { + put_module(FIREWIRE_MODULE_NAME); + return ENOMEM; + } for (i=0; i Author: mmu_man Date: 2008-01-13 02:07:20 +0100 (Sun, 13 Jan 2008) New Revision: 23468 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23468&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/atari_memory_map.h Modified: haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: * Add atari memory map defs. * Add osheader defs. * Check for FPU. * note on prg vs bootsector. * mmu stuff. Added: haiku/trunk/src/system/boot/platform/atari_m68k/atari_memory_map.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/atari_memory_map.h 2008-01-13 00:58:27 UTC (rev 23467) +++ haiku/trunk/src/system/boot/platform/atari_m68k/atari_memory_map.h 2008-01-13 01:07:20 UTC (rev 23468) @@ -0,0 +1,23 @@ +/* + * Copyright 2008, Fran?ois Revol, revol at free.fr. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef ATARI_MEMORY_MAP_H +#define ATARI_MEMORY_MAP_H + +#define ATARI_CHIPRAM_TOP_TT 0x00a00000 +/* -> e00000 is VME for MegaST*/ +#define ATARI_CHIPRAM_TOP_FALCON 0x00e00000 + +#define ATARI_ROM_BASE ATARI_CHIPRAM_TOP_FALCON +#define ATARI_ROM_TOP 0x00f00000 +#define ATARI_IO_BASE ATARI_ROM_TOP +#define ATARI_CARTRIDGE_BASE 0x00fa0000 +#define ATARI_OLD_ROM_BASE 0x00fc0000 + +#define ATARI_IO_TOP 0x01000000 +#define ATARI_FASTRAM_TOP ATARI_IO_TOP + +#define ATARI_SHADOW_BASE 0xff000000 + +#endif /* ATARI_MEMORY_MAP_H */ Modified: haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp 2008-01-13 00:58:27 UTC (rev 23467) +++ haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp 2008-01-13 01:07:20 UTC (rev 23468) @@ -29,12 +29,15 @@ # define TRACE(x) ; #endif +#warning M68K: add set_vbr() + static status_t check_cpu_features() { #warning M68K: TODO: probe ourselves, we shouldn't trust the TOS! - const tos_cookie *c = tos_find_cookie('_CPU'); + const tos_cookie *c; + c = tos_find_cookie('_CPU'); if (!c) { panic("can't get a cookie (_CPU)! Mum, I'm hungry!"); return EINVAL; @@ -47,6 +50,18 @@ gKernelArgs.arch_args.has_lpstop = (c->ivalue >= 60)?true:false; #warning M68K: add cpu type to kern args + c = tos_find_cookie('_FPU'); + if (!c) { + panic("can't get a cookie (_FPU)! Mum, I'm hungry!"); + return EINVAL; + } + +#warning M68K: check for fpu in detail + if (c->ivalue < 2 || c->ivalue > 7) { + panic("bad fpu"); + return EINVAL; + } + return B_OK; } Modified: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp 2008-01-13 00:58:27 UTC (rev 23467) +++ haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp 2008-01-13 01:07:20 UTC (rev 23468) @@ -48,42 +48,12 @@ # define TRACE(x) ; #endif -struct gdt_idt_descr { - uint16 limit; - uint32 *base; -} _PACKED; - -// memory structure returned by int 0x15, ax 0xe820 -struct extended_memory { - uint64 base_addr; - uint64 length; - uint32 type; -}; - -#ifdef _PXE_ENV - static const uint32 kDefaultPageTableFlags = 0x07; // present, user, R/W static const size_t kMaxKernelSize = 0x100000; // 1 MB for the kernel // working page directory and page table static uint32 *sPageDirectory = 0; -static addr_t sNextPhysicalAddress = 0x112000; -static addr_t sNextVirtualAddress = KERNEL_BASE + kMaxKernelSize; -static addr_t sMaxVirtualAddress = KERNEL_BASE + 0x400000; - -static addr_t sNextPageTableAddress = 0x7d000; -static const uint32 kPageTableRegionEnd = 0x8b000; - // we need to reserve 2 pages for the SMP trampoline code - -#else - -static const uint32 kDefaultPageTableFlags = 0x07; // present, user, R/W -static const size_t kMaxKernelSize = 0x100000; // 1 MB for the kernel - -// working page directory and page table -static uint32 *sPageDirectory = 0; - static addr_t sNextPhysicalAddress = 0x100000; static addr_t sNextVirtualAddress = KERNEL_BASE + kMaxKernelSize; static addr_t sMaxVirtualAddress = KERNEL_BASE + 0x400000; @@ -92,9 +62,6 @@ static const uint32 kPageTableRegionEnd = 0x9e000; // we need to reserve 2 pages for the SMP trampoline code -#endif - - static addr_t get_next_virtual_address(size_t size) { Modified: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h 2008-01-13 00:58:27 UTC (rev 23467) +++ haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h 2008-01-13 01:07:20 UTC (rev 23468) @@ -22,6 +22,12 @@ extern void *mmu_allocate(void *virtualAddress, size_t size); extern void mmu_free(void *virtualAddress, size_t size); +struct boot_mmu_ops { + // len=0 to disable + status_t (*set_tt)(int which, addr_t pa, size_t len, uint32 perms); + +}; + #ifdef __cplusplus } #endif Modified: haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-13 00:58:27 UTC (rev 23467) +++ haiku/trunk/src/system/boot/platform/atari_m68k/stage1.S 2008-01-13 01:07:20 UTC (rev 23468) @@ -73,6 +73,12 @@ #define S_IFDIR 00000040000o +// NOTE: normal programs (.prg) run as user mode, +// while boot sector is chained in supervisor mode. +// this means using Super(SUP_INQUIRE) we can know +// from the same entry point if we were run from boot code or prg. + + //Pterm0 //move.w #1,%d0 //trap #1 Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-13 00:58:27 UTC (rev 23467) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-13 01:07:20 UTC (rev 23468) @@ -129,6 +129,12 @@ extern int32 gemdos(uint16 nr, ...); +#define SUP_USER 0 +#define SUP_SUPER 1 + +#define SUP_SET (void *)0 +#define SUP_INQUIRE (void *)1 + // official names #define Pterm0() gemdos(0) #define Cconin() gemdos(1) @@ -167,6 +173,33 @@ return NULL; } +/* + * OSHEADER access + */ + +typedef struct tos_osheader { + uint16 os_entry; + uint16 os_version; + void *reseth; + struct tos_osheader *os_beg; + void *os_end; + void *os_rsv1; + void *os_magic; + uint32 os_date; + uint32 os_conf; + //uint32/16? os_dosdate; + // ... more stuff we don't care about +} tos_osheader; + +#define tos_sysbase ((const struct tos_osheader **)0x4F2) + +static inline const struct tos_osheader *tos_get_osheader() +{ + if (!(*tos_sysbase)) + return NULL; + return (*tos_sysbase)->os_beg; +} + #endif /* __ASSEMBLER__ */ #ifdef __cplusplus From mmu_man at mail.berlios.de Sun Jan 13 02:12:40 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 02:12:40 +0100 Subject: [Haiku-commits] r23469 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801130112.m0D1Cehl015983@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 02:12:40 +0100 (Sun, 13 Jan 2008) New Revision: 23469 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23469&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp Log: #if out x86 stuff to try to build zbeos Modified: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp 2008-01-13 01:07:20 UTC (rev 23468) +++ haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp 2008-01-13 01:12:40 UTC (rev 23469) @@ -117,6 +117,7 @@ add_page_table(addr_t base) { TRACE(("add_page_table(base = %p)\n", (void *)base)); +#if 0 // Get new page table and clear it out uint32 *pageTable = get_next_page_table(); @@ -130,6 +131,7 @@ // put the new page table into the page directory sPageDirectory[base/(4*1024*1024)] = (uint32)pageTable | kDefaultPageTableFlags; +#endif } @@ -140,6 +142,7 @@ if (virtualAddress < KERNEL_BASE) panic("unmap_page: asked to unmap invalid page %p!\n", (void *)virtualAddress); +#if 0 // unmap the page from the correct page table uint32 *pageTable = (uint32 *)(sPageDirectory[virtualAddress @@ -147,6 +150,7 @@ pageTable[(virtualAddress % (B_PAGE_SIZE * 1024)) / B_PAGE_SIZE] = 0; asm volatile("invlpg (%0)" : : "r" (virtualAddress)); +#endif } @@ -213,6 +217,7 @@ } +#if 0 static uint32 get_memory_map(extended_memory **_extendedMemory) { @@ -246,6 +251,7 @@ return count; } +#endif static void @@ -253,6 +259,7 @@ { TRACE(("init_page_directory\n")); +#if 0 // allocate a new pgdir sPageDirectory = (uint32 *)get_next_physical_page(); gKernelArgs.arch_args.phys_pgdir = (uint32)sPageDirectory; @@ -292,6 +299,7 @@ "movl %%eax, %%cr3;" : : "m" (sPageDirectory) : "eax"); // Important. Make sure supervisor threads can fault on read only pages... asm("movl %%eax, %%cr0" : : "a" ((1 << 31) | (1 << 16) | (1 << 5) | 1)); +#endif } @@ -396,6 +404,7 @@ mmu_init_for_kernel(void) { TRACE(("mmu_init_for_kernel\n")); +#if 0 // set up a new idt { struct gdt_idt_descr idtDescriptor; @@ -509,6 +518,7 @@ } } #endif +#endif } @@ -523,6 +533,7 @@ // remember the start of the allocated physical pages init_page_directory(); +#if 0 // Map the page directory into kernel space at 0xffc00000-0xffffffff // this enables a mmu trick where the 4 MB region that this pgdir entry @@ -604,6 +615,7 @@ } gKernelArgs.arch_args.page_hole = 0xffc00000; +#endif } From mmu_man at mail.berlios.de Sun Jan 13 02:15:47 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 02:15:47 +0100 Subject: [Haiku-commits] r23470 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801130115.m0D1FlDG016730@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 02:15:46 +0100 (Sun, 13 Jan 2008) New Revision: 23470 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23470&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp Log: More #if 0 Modified: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp 2008-01-13 01:12:40 UTC (rev 23469) +++ haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp 2008-01-13 01:15:46 UTC (rev 23470) @@ -167,6 +167,7 @@ if (virtualAddress < KERNEL_BASE) panic("map_page: asked to map invalid page %p!\n", (void *)virtualAddress); +#if 0 if (virtualAddress >= sMaxVirtualAddress) { // we need to add a new page table @@ -191,7 +192,7 @@ pageTable[tableEntry] = physicalAddress | flags; asm volatile("invlpg (%0)" : : "r" (virtualAddress)); - +#endif TRACE(("map_page: done\n")); } From mmu_man at mail.berlios.de Sun Jan 13 02:38:07 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 02:38:07 +0100 Subject: [Haiku-commits] r23471 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801130138.m0D1c7HU018723@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 02:38:06 +0100 (Sun, 13 Jan 2008) New Revision: 23471 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23471&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: Entry point for .prg / bootfloppy for zbeos. Added: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 01:15:46 UTC (rev 23470) +++ haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 01:38:06 UTC (rev 23471) @@ -0,0 +1,126 @@ +/* + * Copyright 2004-2005, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2005, Ingo Weinhold, bonefish at users.sf.net. + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT license. + * + * Author: + * Fran?ois Revol, revol at free.fr. + */ + +/** This file contains the boot floppy and BFS boot block entry points for + * the stage 2 boot loader. + * x86 ahead: + * The floppy entry point is at offset 0. It's loaded at 0x07c0:0x000. It + * will load the rest of the loader to 0x1000:0x0200 and execute it. + * The BFS boot block will load the whole stage 2 loader to 0x1000:0x0000 + * and will then jump to 0x1000:0x0200 as its entry point. + * This code will then switch to protected mode and will directly call + * the entry function of the embedded ELF part of the loader. + */ + + + +#include "toscalls.h" + +// 1 enabled verbose output +//#define DEBUG 1 + +#define GLOBAL(x) .globl x ; x +#define FUNCTION(x) .global x; .type x, at function; x + +#define DRIVE_RETRIES 3 + // when the drive reading fails for some reason, it will + // retry this many times until it will report a failure + +.text + +/* main entry point, both from the floppy boot and .prg */ + + // first, determine if .prg (user) or bootsect (super) + // Super() + move.l SUP_INQUIRE,-(%sp) + move.w #0x20,%d0 + trap #1 + addq.l #6,%sp + cmp.w #SUP_SUPER,%d0 + beq floppy_start + bra prg_start + bra bootsect_start + rts +floppy_start: + +floppy_end: + .org FAILURE_STRING + .string " Loading failed! Press key to reboot.\r\n" + .org DOT_STRING + .string "." + + .org 0x01fe + .word 0xaa55 + // this bumps the "start" label to offset 0x0200 as + // expected by the BFS boot loader, and also marks + // this block as valid boot block for the BIOS + +prg_start: + // .prg: + // we need to switch to supervisor mode anyway + move.l SUP_SET,-(%sp) + move.w #0x20,%d0 + trap #1 + addq.l #6,%sp + move.l %d0,saved_super_stack + // all done + + +super_done: + + jsr _start + +saved_super_stack: + .long 0 + +GLOBAL(gBootedFromImage): + .byte 0 + +GLOBAL(gBootDriveID): + .byte 0 + +GLOBAL(gBootPartitionOffset): + .long 0 + + + + + lea.l str,%a0 +.loopt: + move.b (%a0)+,%d0 + beq .strout + bsr putc + bra .loopt +.strout: + //Pterm0 + move.w #1,%d0 + trap #1 + + rts + +.loop: + move #'.',%d0 + bsr putc + bra .loop + rts + +/* prints the char in d0.b to the console */ +putc: + movem.l %a0,-(%sp) + move.w %d0,-(%sp) + move.w #DEV_CON,-(%sp) // DEV_CON + move.w #3,-(%sp) // Bconout + trap #13 + add.l #6,%sp + movem.l (%sp)+,%a0 + rts +str: + .ascii "Haiku!" + .byte 0 Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-13 01:15:46 UTC (rev 23470) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-13 01:38:06 UTC (rev 23471) @@ -37,6 +37,11 @@ #define RW_NORETRY 0x04 #define RW_NOTRANSLATE 0x08 +#define SUP_USER 0 +#define SUP_SUPER 1 +#define SUP_SET 0 +#define SUP_INQUIRE 1 + #ifndef __ASSEMBLER__ /* @@ -129,9 +134,8 @@ extern int32 gemdos(uint16 nr, ...); -#define SUP_USER 0 -#define SUP_SUPER 1 - +#undef SUP_SET +#undef SUP_INQUIRE #define SUP_SET (void *)0 #define SUP_INQUIRE (void *)1 From mmu_man at mail.berlios.de Sun Jan 13 02:41:26 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 02:41:26 +0100 Subject: [Haiku-commits] r23472 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801130141.m0D1fQ5M019159@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 02:41:25 +0100 (Sun, 13 Jan 2008) New Revision: 23472 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23472&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: Make it compile. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 01:38:06 UTC (rev 23471) +++ haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 01:41:25 UTC (rev 23472) @@ -51,12 +51,12 @@ floppy_start: floppy_end: - .org FAILURE_STRING +// .org FAILURE_STRING .string " Loading failed! Press key to reboot.\r\n" - .org DOT_STRING +// .org DOT_STRING .string "." - .org 0x01fe +// .org 0x01fe .word 0xaa55 // this bumps the "start" label to offset 0x0200 as // expected by the BFS boot loader, and also marks Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-13 01:38:06 UTC (rev 23471) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-13 01:41:25 UTC (rev 23472) @@ -9,12 +9,12 @@ #ifndef _TOSCALLS_H #define _TOSCALLS_H -#include - #ifdef __cplusplus extern "C" { #endif +/* those are used by asm code too */ + #define DEV_PRINTER 0 #define DEV_AUX 1 #define DEV_CON 2 @@ -44,6 +44,8 @@ #ifndef __ASSEMBLER__ +#include + /* * Atari BIOS calls */ From mmu_man at mail.berlios.de Sun Jan 13 02:45:45 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 02:45:45 +0100 Subject: [Haiku-commits] r23473 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801130145.m0D1jj78019757@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 02:45:45 +0100 (Sun, 13 Jan 2008) New Revision: 23473 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23473&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile haiku/trunk/src/system/boot/platform/atari_m68k/shell.S Log: * shell.S must be first Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-13 01:41:25 UTC (rev 23472) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-13 01:45:45 UTC (rev 23473) @@ -21,6 +21,7 @@ KernelMergeObject boot_platform_atari_m68k.o : shell.S start.c + toscalls.S debug.c #bios.S console.cpp Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 01:41:25 UTC (rev 23472) +++ haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 01:45:45 UTC (rev 23473) @@ -46,7 +46,7 @@ cmp.w #SUP_SUPER,%d0 beq floppy_start bra prg_start - bra bootsect_start + //bra bootsect_start rts floppy_start: From marcusoverhagen at mail.berlios.de Sun Jan 13 02:50:58 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 13 Jan 2008 02:50:58 +0100 Subject: [Haiku-commits] r23474 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801130150.m0D1owMw020169@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-13 02:50:58 +0100 (Sun, 13 Jan 2008) New Revision: 23474 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23474&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c Log: ATAPI fix Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-13 01:45:45 UTC (rev 23473) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-13 01:50:58 UTC (rev 23474) @@ -1115,7 +1115,7 @@ return B_ERROR; } - if (ata_wait(bus, ide_status_drq, ide_status_bsy, 0, 500000) != B_OK) { + if (ata_wait(bus, ide_status_drq, ide_status_bsy, 0, isAtapi ? 3000000 : 500000) != B_OK) { TRACE("ata_identify_device: wait failed\n"); return B_ERROR; } @@ -1129,7 +1129,7 @@ return B_ERROR; } - if (ata_finish_command(device, &request, ATA_WAIT_FINISH | ATA_DRDY_REQUIRED, ide_error_abrt) != B_OK) + if (ata_finish_command(device, &request, ATA_WAIT_FINISH | ( isAtapi ? 0 : ATA_DRDY_REQUIRED), ide_error_abrt) != B_OK) return B_ERROR; TRACE("ata_identify_device: success\n"); From marcusoverhagen at mail.berlios.de Sun Jan 13 02:54:08 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 13 Jan 2008 02:54:08 +0100 Subject: [Haiku-commits] r23475 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801130154.m0D1s8rg020270@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-13 02:54:08 +0100 (Sun, 13 Jan 2008) New Revision: 23475 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23475&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c Log: improved timeout handling Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-13 01:50:58 UTC (rev 23474) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-13 01:54:08 UTC (rev 23475) @@ -21,6 +21,8 @@ static void ata_exec_dma_transfer(ata_request *request); static void ata_exec_pio_transfer(ata_request *request); +status_t ata_wait_idle(ide_bus_info *bus); +status_t ata_read_status(ide_device_info *device, uint8 *status); void @@ -812,7 +814,7 @@ { ide_device_info *device = request->device; ide_bus_info *bus = device->bus; - uint32 timeout = request->ccb->timeout > 0 ? + bigtime_t timeout = request->ccb->timeout > 0 ? request->ccb->timeout * 1000 : IDE_STD_TIMEOUT; // FLOW("ata_exec_pio_transfer: length %d, left_blocks %d, left_sg_elem %d, cur_sg_ofs %d\n", @@ -821,7 +823,7 @@ while (device->left_blocks > 0) { - if (ata_wait(bus, ide_status_drq, ide_status_bsy, 0, 4000000) != B_OK) { + if (ata_wait(bus, ide_status_drq, ide_status_bsy, 0, timeout) != B_OK) { TRACE("ata_exec_pio_transfer: wait failed\n"); goto error; } From mmu_man at mail.berlios.de Sun Jan 13 02:54:11 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 02:54:11 +0100 Subject: [Haiku-commits] r23476 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801130154.m0D1sBB7020306@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 02:54:11 +0100 (Sun, 13 Jan 2008) New Revision: 23476 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23476&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile Log: Missed this file to the club. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp 2008-01-13 01:54:08 UTC (rev 23475) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Handle.cpp 2008-01-13 01:54:11 UTC (rev 23476) @@ -9,7 +9,7 @@ #include #include "Handle.h" -#include "toscalls." +#include "toscalls.h" /* * (X)BIOS supports char and block devices with a separate namespace @@ -27,7 +27,7 @@ Handle::Handle(int handle) : - fHandle((int16)handle), + fHandle((int16)handle) { } @@ -97,7 +97,8 @@ ssize_t CharHandle::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) { - const char *string = (const char *)buffer; + char *string = (char *)buffer; + int i; // can't seek for (i = 0; i < bufferSize; i++) { @@ -114,6 +115,7 @@ CharHandle::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) { const char *string = (const char *)buffer; + int i; // can't seek @@ -126,11 +128,3 @@ } -off_t -CharHandle::Size() const -{ - // ToDo: fix this! - return 1024LL * 1024 * 1024 * 1024; - // 1024 GB -} - Modified: haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-13 01:54:08 UTC (rev 23475) +++ haiku/trunk/src/system/boot/platform/atari_m68k/Jamfile 2008-01-13 01:54:11 UTC (rev 23476) @@ -26,6 +26,7 @@ #bios.S console.cpp #serial.cpp + Handle.cpp devices.cpp keyboard.cpp menu.cpp From marcusoverhagen at mail.berlios.de Sun Jan 13 03:42:21 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 13 Jan 2008 03:42:21 +0100 Subject: [Haiku-commits] r23478 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801130242.m0D2gLOf024219@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-13 03:42:19 +0100 (Sun, 13 Jan 2008) New Revision: 23478 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23478&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c Log: Allow ata_request_set_sense and ata_request_set_status to be called with NULL request pointer. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-13 01:57:31 UTC (rev 23477) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-13 02:42:19 UTC (rev 23478) @@ -78,7 +78,7 @@ ata_request_set_status(ata_request *request, uint8 status) { ASSERT(status != SCSI_REQ_CMP); - if (request->ccb) + if (request && request->ccb) request->ccb->subsys_status = status; } @@ -86,9 +86,11 @@ void ata_request_set_sense(ata_request *request, uint8 key, uint16 asc_acq) { - request->senseKey = key; - request->senseAsc = asc_acq >> 8; - request->senseAscq = asc_acq & 0xff; + if (request) { + request->senseKey = key; + request->senseAsc = asc_acq >> 8; + request->senseAscq = asc_acq & 0xff; + } } From axeld at mail.berlios.de Sun Jan 13 03:50:34 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Jan 2008 03:50:34 +0100 Subject: [Haiku-commits] r23479 - in haiku/trunk: headers/private/kernel src/add-ons/kernel/file_systems/bfs src/system/kernel/debug Message-ID: <200801130250.m0D2oYf9024534@sheep.berlios.de> Author: axeld Date: 2008-01-13 03:50:32 +0100 (Sun, 13 Jan 2008) New Revision: 23479 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23479&view=rev Modified: haiku/trunk/headers/private/kernel/tracing.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp haiku/trunk/src/system/kernel/debug/tracing.cpp Log: Some more work on the tracing API: * Added function to allocate space in the buffer. * Dump() now fills a buffer instead of printing its data directly. * This allows the new "#pattern" argument of the "traced" command to work. When you're using that, the index of the trace entry is printed out, too, so that you can then get a full dump around the hits. * Added an AddDump() method to the AbstractTraceEntry class so that there is no need to call the inherited function anymore. * Minor cleanup. Modified: haiku/trunk/headers/private/kernel/tracing.h =================================================================== --- haiku/trunk/headers/private/kernel/tracing.h 2008-01-13 02:42:19 UTC (rev 23478) +++ haiku/trunk/headers/private/kernel/tracing.h 2008-01-13 02:50:32 UTC (rev 23479) @@ -5,7 +5,9 @@ #include #include +#include + #define ENABLE_TRACING 0 #define MAX_TRACE_SIZE 1024 * 1024 @@ -23,7 +25,7 @@ TraceEntry(); virtual ~TraceEntry(); - virtual void Dump(); + virtual void Dump(char* buffer, size_t bufferSize); size_t Size() const { return size; } uint16 Flags() const { return flags; } @@ -42,11 +44,17 @@ { } - virtual void Dump() + virtual void Dump(char* buffer, size_t bufferSize) { - kprintf("[%6ld] %Ld: ", fThread, fTime); + int length = snprintf(buffer, bufferSize, "[%6ld] %Ld: ", + fThread, fTime); + AddDump(buffer + length, bufferSize - length); } + virtual void AddDump(char* buffer, size_t bufferSize) + { + } + thread_id Thread() const { return fThread; } bigtime_t Time() const { return fTime; } @@ -58,8 +66,14 @@ #endif // __cplusplus #ifdef __cplusplus -extern "C" +extern "C" { #endif + +uint8* alloc_tracing_buffer(size_t size); status_t tracing_init(void); +#ifdef __cplusplus +} +#endif + #endif /* KERNEL_UTIL_TRACING_H */ Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-01-13 02:42:19 UTC (rev 23478) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-01-13 02:50:32 UTC (rev 23479) @@ -48,11 +48,10 @@ Initialized(); } - virtual void Dump() + virtual void AddDump(char *buffer, size_t size) { - AbstractTraceEntry::Dump(); - kprintf("alloc %lu.%u.%u\n", fRun.AllocationGroup(), fRun.Start(), - fRun.Length()); + snprintf(buffer, size, "alloc %lu.%u.%u", fRun.AllocationGroup(), + fRun.Start(), fRun.Length()); } private: @@ -68,11 +67,10 @@ Initialized(); } - virtual void Dump() + virtual void AddDump(char *buffer, size_t size) { - AbstractTraceEntry::Dump(); - kprintf("free %lu.%u.%u\n", fRun.AllocationGroup(), fRun.Start(), - fRun.Length()); + snprintf(buffer, size, "free %lu.%u.%u\n", fRun.AllocationGroup(), + fRun.Start(), fRun.Length()); } private: Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2008-01-13 02:42:19 UTC (rev 23478) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2008-01-13 02:50:32 UTC (rev 23479) @@ -36,12 +36,11 @@ Initialized(); } - virtual void Dump() + virtual void AddDump(char *buffer, size_t size) { - AbstractTraceEntry::Dump(); - kprintf("CREATE %Ld (%p), parent %Ld (%p), \"%s\", mode %lx, " - "omode %x, type %lx\n", fID, fInode, fParentID, fParent, - fName, fMode, fOpenMode, fType); + snprintf(buffer, size, "CREATE %Ld (%p), parent %Ld (%p), \"%s\", " + "mode %lx, omode %x, type %lx\n", fID, fInode, fParentID, + fParent, fName, fMode, fOpenMode, fType); } private: @@ -67,10 +66,10 @@ Initialized(); } - virtual void Dump() + virtual void AddDump(char *buffer, size_t size) { - AbstractTraceEntry::Dump(); - kprintf("REMOVE %Ld (%p), \"%s\"\n", fID, fInode, fName); + snprintf(buffer, size, "REMOVE %Ld (%p), \"%s\"\n", fID, fInode, + fName); } private: @@ -91,11 +90,10 @@ Initialized(); } - virtual void Dump() + virtual void AddDump(char *buffer, size_t size) { - AbstractTraceEntry::Dump(); - kprintf("RESIZE %Ld (%p), %Ld -> %Ld\n", fID, fInode, fOldSize, - fNewSize); + snprintf(buffer, size, "RESIZE %Ld (%p), %Ld -> %Ld\n", fID, fInode, + fOldSize, fNewSize); } private: Modified: haiku/trunk/src/system/kernel/debug/tracing.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/tracing.cpp 2008-01-13 02:42:19 UTC (rev 23478) +++ haiku/trunk/src/system/kernel/debug/tracing.cpp 2008-01-13 02:50:32 UTC (rev 23479) @@ -9,7 +9,8 @@ enum { WRAP_ENTRY = 0x01, - ENTRY_INITIALIZED = 0x02 + ENTRY_INITIALIZED = 0x02, + BUFFER_ENTRY = 0x04 }; static const size_t kBufferSize = MAX_TRACE_SIZE / 4 - 1; @@ -36,9 +37,9 @@ static void -make_space(size_t size) +make_space(size_t needed) { - if (sBufferEnd + size / 4 > sBuffer + kBufferSize - 1) { + if (sBufferEnd + needed / 4 > sBuffer + kBufferSize - 1) { sBufferEnd->size = 0; sBufferEnd->flags = WRAP_ENTRY; sBufferEnd = sBuffer; @@ -48,23 +49,52 @@ if (diff < 0) sBufferEnd = sBuffer; else - size -= diff; + needed -= diff; while (true) { - uint16 skip = sBufferStart->size; + uint16 freed = sBufferStart->size; sBufferStart = next_entry(sBufferStart); if (sBufferStart == NULL) - sBufferStart = sBuffer; + sBufferStart = sBufferEnd; sEntries--; - if (size <= skip) + if (needed <= freed) break; - size -= skip; + needed -= freed; } } +trace_entry* +allocate_entry(size_t size) +{ + if (sBuffer == NULL) + return NULL; + + InterruptsSpinLocker _(sLock); + + size = (size + 3) & ~3; + + if (sBufferStart < sBufferEnd || sEntries == 0) { + // the buffer ahead of us is still empty + uint32 space = (sBuffer + kBufferSize - sBufferEnd) * 4; + if (space < size) + make_space(size); + } else { + // we need to overwrite existing entries + make_space(size); + } + + trace_entry* entry = sBufferEnd; + entry->size = size; + entry->flags = 0; + sBufferEnd += size >> 2; + sEntries++; + return entry; +} + + #endif // ENABLE_TRACING @@ -82,11 +112,11 @@ void -TraceEntry::Dump() +TraceEntry::Dump(char* buffer, size_t bufferSize) { #if ENABLE_TRACING // to be overloaded by subclasses - kprintf("ENTRY %p\n", this); + snprintf(buffer, bufferSize, "ENTRY %p", this); #endif } @@ -104,30 +134,8 @@ TraceEntry::operator new(size_t size, const std::nothrow_t&) throw() { #if ENABLE_TRACING - if (sBuffer == NULL) - return NULL; - - InterruptsSpinLocker _(sLock); - - size = (size + 3) & ~3; - - if (sBufferStart < sBufferEnd || sEntries == 0) { - // the buffer ahead of us is still empty - uint32 space = (sBuffer + kBufferSize - sBufferEnd) * 4; - if (space < size) - make_space(size); - } else { - // we need to overwrite existing entries - make_space(size); - } - - trace_entry* entry = sBufferEnd; - entry->size = size; - entry->flags = 0; - sBufferEnd += size >> 2; - sEntries++; - return entry; -#else // !ENABLE_TRACING + return allocate_entry(size); +#else return NULL; #endif } @@ -142,6 +150,10 @@ int dump_tracing(int argc, char** argv) { + const char *pattern = NULL; + if (argv[argc - 1][0] == '#') + pattern = argv[--argc] + 1; + int32 count = 30; if (argc == 2) count = strtol(argv[1], NULL, 0); @@ -152,7 +164,7 @@ start = strtol(argv[1], NULL, 0); count = strtol(argv[2], NULL, 0); } else if (argc > 3) { - kprintf("usage: %s [start] [count]\n", argv[0]); + kprintf("usage: %s [start] [count] [#pattern]\n", argv[0]); return 0; } // TODO: add pattern matching mechanism for the class name @@ -168,11 +180,26 @@ continue; if (index > start + count) break; + if ((entry->flags & BUFFER_ENTRY) != 0) { + // skip buffer entries + index--; + continue; + } - if ((current->flags & ENTRY_INITIALIZED) != 0) - ((TraceEntry*)current)->Dump(); - else - kprintf("** uninitialized entry **\n"); + if ((current->flags & ENTRY_INITIALIZED) != 0) { + char buffer[256]; + buffer[0] = '\0'; + ((TraceEntry*)current)->Dump(buffer, sizeof(buffer)); + + if (pattern != NULL && strstr(buffer, pattern) == NULL) + continue; + + if (pattern != NULL) + kprintf("%5ld. %s\n", index, buffer); + else + kprintf("%s\n", buffer); + } else + kprintf("%5ld. ** uninitialized entry **\n", index); } kprintf("%ld of %ld entries.\n", count, sEntries); @@ -182,7 +209,22 @@ #endif // ENABLE_TRACING +extern "C" uint8* +alloc_tracing_buffer(size_t size) +{ +#if ENABLE_TRACING + trace_entry* entry = allocate_entry(size + sizeof(trace_entry)); + if (entry == NULL) + return NULL; + entry->flags = BUFFER_ENTRY; + return (uint8*)(entry + 1); +#else + return NULL; +#endif +} + + extern "C" status_t tracing_init(void) { From mmu_man at mail.berlios.de Sun Jan 13 02:57:32 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 02:57:32 +0100 Subject: [Haiku-commits] r23477 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801130157.m0D1vWU9020551@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 02:57:31 +0100 (Sun, 13 Jan 2008) New Revision: 23477 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23477&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp Log: Fake system_time() for now. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp 2008-01-13 01:54:11 UTC (rev 23476) +++ haiku/trunk/src/system/boot/platform/atari_m68k/cpu.cpp 2008-01-13 01:57:31 UTC (rev 23477) @@ -65,7 +65,15 @@ return B_OK; } +#warning M68K: move and implement system_time() +static bigtime_t gSystemTimeCounter = 0; //HACK +extern "C" bigtime_t +system_time(void) +{ + return gSystemTimeCounter++; +} + // #pragma mark - From mmu_man at mail.berlios.de Sun Jan 13 10:31:54 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 10:31:54 +0100 Subject: [Haiku-commits] r23480 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801130931.m0D9VsgY031902@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 10:31:53 +0100 (Sun, 13 Jan 2008) New Revision: 23480 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23480&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/atari_memory_map.h haiku/trunk/src/system/boot/platform/atari_m68k/shell.S Log: 1st try at floppy bootsector. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/atari_memory_map.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/atari_memory_map.h 2008-01-13 02:50:32 UTC (rev 23479) +++ haiku/trunk/src/system/boot/platform/atari_m68k/atari_memory_map.h 2008-01-13 09:31:53 UTC (rev 23480) @@ -20,4 +20,8 @@ #define ATARI_SHADOW_BASE 0xff000000 +/* how we will use it */ +#define ATARI_ZBEOS_STACK_BASE 0x00008000 +#define ATARI_ZBEOS_BASE 0x00010000 /* from .prg shell.S will copy itself there */ + #endif /* ATARI_MEMORY_MAP_H */ Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 02:50:32 UTC (rev 23479) +++ haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 09:31:53 UTC (rev 23480) @@ -20,7 +20,7 @@ */ - +#include "atari_memory_map.h" #include "toscalls.h" // 1 enabled verbose output @@ -36,7 +36,17 @@ .text /* main entry point, both from the floppy boot and .prg */ + bra real_entry +sNumSectors: + // this location will contain the length of the boot loader as + // written by the "makeflop" command in 512 byte blocks + // 0x180 is the allowed maximum, as the zipped TAR with the + // kernel and the boot module might start at offset 192 kB + .word 0x0180 + +real_entry: + // first, determine if .prg (user) or bootsect (super) // Super() move.l SUP_INQUIRE,-(%sp) @@ -49,7 +59,36 @@ //bra bootsect_start rts floppy_start: + // no interrupt + and.w #0x0700,%sr + // setup stack + move.l #ATARI_ZBEOS_STACK_BASE,%sp + //XXX: check for enough RAM + // load the rest + move.w #sNumSectors,%d2 + // load at base + this code. + move.l #ATARI_ZBEOS_BASE+512,%a2 + bsr load_sectors + + jmp #ATARI_ZBEOS_BASE+512 +/** Loads %d2 sectors from floppy disk, starting at head XXX %dh, sector %cx. + * The data is loaded to %a2. + */ + +load_sectors: + + // Rwabs + move.w #0,-(%sp) // A: + move.w #1,-(%sp) // 2nd sector + move.w %d2,-(%sp) + move.l %a2,-(%sp) + move.w RW_,-(%sp) + move.w #4,-(%sp) + trap #13 + add.l #14,%sp + rts + floppy_end: // .org FAILURE_STRING .string " Loading failed! Press key to reboot.\r\n" @@ -71,8 +110,11 @@ addq.l #6,%sp move.l %d0,saved_super_stack // all done + lea unimpl,%a0 + jsr puts +prg_spin: + bra prg_spin - super_done: jsr _start @@ -93,6 +135,7 @@ lea.l str,%a0 +puts: .loopt: move.b (%a0)+,%d0 beq .strout @@ -122,5 +165,6 @@ movem.l (%sp)+,%a0 rts str: - .ascii "Haiku!" - .byte 0 + .string "Haiku!" +unimpl: + .string "Unimplemented." From mmu_man at mail.berlios.de Sun Jan 13 10:38:57 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 10:38:57 +0100 Subject: [Haiku-commits] r23481 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801130938.m0D9cvFv032192@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 10:38:56 +0100 (Sun, 13 Jan 2008) New Revision: 23481 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23481&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S Log: Forgot a param. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 09:31:53 UTC (rev 23480) +++ haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 09:38:56 UTC (rev 23481) @@ -83,7 +83,7 @@ move.w #1,-(%sp) // 2nd sector move.w %d2,-(%sp) move.l %a2,-(%sp) - move.w RW_,-(%sp) + move.w RW_READ+RW_NOTRANSLATE,-(%sp) move.w #4,-(%sp) trap #13 add.l #14,%sp From marcusoverhagen at mail.berlios.de Sun Jan 13 10:41:40 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 13 Jan 2008 10:41:40 +0100 Subject: [Haiku-commits] r23482 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801130941.m0D9febE032461@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-13 10:41:40 +0100 (Sun, 13 Jan 2008) New Revision: 23482 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23482&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c Log: fixed a crash during device identification Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-13 09:38:56 UTC (rev 23481) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata_request.c 2008-01-13 09:41:40 UTC (rev 23482) @@ -9,7 +9,7 @@ void ata_request_init(ata_request *request, struct ide_device_info *device) { - memset(request, 0, sizeof(request)); + memset(request, 0, sizeof(*request)); request->device = device; } From mmu_man at mail.berlios.de Sun Jan 13 11:53:35 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 11:53:35 +0100 Subject: [Haiku-commits] r23483 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801131053.m0DArZ1w003108@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 11:53:35 +0100 (Sun, 13 Jan 2008) New Revision: 23483 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23483&view=rev Added: haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S Log: * Moved checksum to where it should be. * Added tool to calculate the checksum (TOS wants a real one to 1234, not aa55). Added: haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c 2008-01-13 09:41:40 UTC (rev 23482) +++ haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c 2008-01-13 10:53:35 UTC (rev 23483) @@ -0,0 +1,28 @@ +#include +#include +#include + + +uint8 sector[512]; + +int main(int argc, char **argv) +{ + int fd, i; + uint16 sum; + uint16 *p = (uint16 *)sector; + fd = open(argv[1], O_RDWR); + if (fd < 0) { + return 1; + } + if (read(fd, sector, 512-2) < 512) { + perror("read"); + return 1; + } + for (sum = 0, i = 0; i < (512-2)/2; i++) { + sum += B_LENDIAN_TO_HOST_INT16(p[i]); + } + p[(512-2)/2] = B_HOST_TO_BENDIAN_INT16(0x1234 - sum); + //lseek(fd, 0LL, SEEK_SET); + write(fd, §or[512-2], 2); + return 0; +} Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 09:41:40 UTC (rev 23482) +++ haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 10:53:35 UTC (rev 23483) @@ -69,7 +69,12 @@ // load at base + this code. move.l #ATARI_ZBEOS_BASE+512,%a2 bsr load_sectors - + tst.l %d0 + beq floppy_done + lea failure_string,%a0 + jsr puts + bra spin +flopy_done: jmp #ATARI_ZBEOS_BASE+512 /** Loads %d2 sectors from floppy disk, starting at head XXX %dh, sector %cx. @@ -91,12 +96,16 @@ floppy_end: // .org FAILURE_STRING +failure_string: .string " Loading failed! Press key to reboot.\r\n" + // .org DOT_STRING .string "." -// .org 0x01fe - .word 0xaa55 +//shell_end: +// .skip 0x01fe - tmp_floppy_end +//// .org 0x01fe +// .word 0xaa55 // this bumps the "start" label to offset 0x0200 as // expected by the BFS boot loader, and also marks // this block as valid boot block for the BIOS @@ -112,8 +121,8 @@ // all done lea unimpl,%a0 jsr puts -prg_spin: - bra prg_spin +spin: + bra spin super_done: @@ -168,3 +177,13 @@ .string "Haiku!" unimpl: .string "Unimplemented." + +shell_end: + .skip 0x01fe - tmp_floppy_end +// .org 0x01fe + .word 0xaa55-1 // will be replaced by the one calculated by the build. + // we make sure we PCs don't try to execute it. + // this bumps the "start" label to offset 0x0200 as + // expected by the BFS boot loader, and also marks + // this block as valid boot block for the BIOS + // XXX: actually TOS wants a real checksum here so sum is 0x1234! From mmu_man at mail.berlios.de Sun Jan 13 12:57:12 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 12:57:12 +0100 Subject: [Haiku-commits] r23484 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801131157.m0DBvCi4017013@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 12:57:11 +0100 (Sun, 13 Jan 2008) New Revision: 23484 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23484&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c haiku/trunk/src/system/boot/platform/atari_m68k/shell.S Log: * jmp is x86... * make the checksumer build under linux and fix it. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c 2008-01-13 10:53:35 UTC (rev 23483) +++ haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c 2008-01-13 11:57:11 UTC (rev 23484) @@ -1,27 +1,29 @@ #include -#include -#include +#include +#include +uint8_t sector[512]; -uint8 sector[512]; - int main(int argc, char **argv) { int fd, i; - uint16 sum; - uint16 *p = (uint16 *)sector; + uint16_t sum; + uint8_t *p = sector; fd = open(argv[1], O_RDWR); if (fd < 0) { return 1; } - if (read(fd, sector, 512-2) < 512) { + if (read(fd, sector, 512-2) < 512-2) { perror("read"); return 1; } - for (sum = 0, i = 0; i < (512-2)/2; i++) { - sum += B_LENDIAN_TO_HOST_INT16(p[i]); + for (sum = 0, i = 0; i < (512-2); i++) { + sum += p[i]; } - p[(512-2)/2] = B_HOST_TO_BENDIAN_INT16(0x1234 - sum); + sum = 0x1234 - sum; + // big endian + p[512-2] = (uint8_t)(sum >> 8); + p[512-1] = (uint8_t)sum; //lseek(fd, 0LL, SEEK_SET); write(fd, §or[512-2], 2); return 0; Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 10:53:35 UTC (rev 23483) +++ haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 11:57:11 UTC (rev 23484) @@ -75,7 +75,7 @@ jsr puts bra spin flopy_done: - jmp #ATARI_ZBEOS_BASE+512 + bra #ATARI_ZBEOS_BASE+512 /** Loads %d2 sectors from floppy disk, starting at head XXX %dh, sector %cx. * The data is loaded to %a2. From marcusoverhagen at mail.berlios.de Sun Jan 13 13:02:14 2008 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 13 Jan 2008 13:02:14 +0100 Subject: [Haiku-commits] r23485 - haiku/trunk/src/add-ons/kernel/bus_managers/ata Message-ID: <200801131202.m0DC2Eqq023334@sheep.berlios.de> Author: marcusoverhagen Date: 2008-01-13 13:02:13 +0100 (Sun, 13 Jan 2008) New Revision: 23485 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23485&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c Log: Fixed timeouts, they were too small. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-13 11:57:11 UTC (rev 23484) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/ata.c 2008-01-13 12:02:13 UTC (rev 23485) @@ -250,7 +250,7 @@ uint8 error; if (flags & ATA_WAIT_FINISH) { - // wait for the command to finish current command (device no longer busy) + // wait for the device to finish current command (device no longer busy) result = ata_wait(bus, 0, ide_status_bsy, 0, request->timeout); if (result != B_OK) { TRACE("ata_finish_command: timeout\n"); @@ -508,7 +508,7 @@ { ide_device_info *device = request->device; uint32 timeout = request->ccb->timeout > 0 ? - request->ccb->timeout * 1000 : IDE_STD_TIMEOUT; + request->ccb->timeout * 1000000 : IDE_STD_TIMEOUT; SHOW_FLOW0(3, ""); @@ -779,7 +779,7 @@ goto error; // if no timeout is specified, use standard - timeout = request->ccb->timeout > 0 ? request->ccb->timeout * 1000 : IDE_STD_TIMEOUT; + timeout = request->ccb->timeout > 0 ? request->ccb->timeout * 1000000 : IDE_STD_TIMEOUT; if (!device->is_atapi) flags |= ATA_DRDY_REQUIRED; @@ -815,7 +815,7 @@ ide_device_info *device = request->device; ide_bus_info *bus = device->bus; bigtime_t timeout = request->ccb->timeout > 0 ? - request->ccb->timeout * 1000 : IDE_STD_TIMEOUT; + request->ccb->timeout * 1000000 : IDE_STD_TIMEOUT; // FLOW("ata_exec_pio_transfer: length %d, left_blocks %d, left_sg_elem %d, cur_sg_ofs %d\n", // request->ccb->data_length, device->left_blocks, device->left_sg_elem, device->cur_sg_ofs); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-13 11:57:11 UTC (rev 23484) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ata/atapi.c 2008-01-13 12:02:13 UTC (rev 23485) @@ -104,7 +104,7 @@ ide_bus_info *bus = device->bus; int status; uint32 timeout = request->ccb->timeout > 0 ? - request->ccb->timeout : IDE_STD_TIMEOUT; + request->ccb->timeout * 1000000 : IDE_STD_TIMEOUT; SHOW_FLOW0(3, ""); @@ -422,7 +422,7 @@ start_dma_wait(device, request); } else { uint32 timeout = request->ccb->timeout > 0 ? - request->ccb->timeout : IDE_STD_TIMEOUT; + request->ccb->timeout * 1000000 : IDE_STD_TIMEOUT; start_waiting(bus, timeout, ide_state_async_waiting); } From mmlr at mail.berlios.de Sun Jan 13 13:08:35 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 13 Jan 2008 13:08:35 +0100 Subject: [Haiku-commits] r23486 - in haiku/trunk: headers/private/kernel src/system/libroot src/system/libroot/posix/stdlib src/system/runtime_loader Message-ID: <200801131208.m0DC8ZMI029779@sheep.berlios.de> Author: mmlr Date: 2008-01-13 13:08:34 +0100 (Sun, 13 Jan 2008) New Revision: 23486 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23486&view=rev Modified: haiku/trunk/headers/private/kernel/user_runtime.h haiku/trunk/src/system/libroot/libroot_init.c haiku/trunk/src/system/libroot/posix/stdlib/exit.c haiku/trunk/src/system/runtime_loader/elf.cpp haiku/trunk/src/system/runtime_loader/export.c Log: bonefish+mmlr: As (our) gcc unfortunately uses atexit() to clean up lazily initialized static variables inside functions we have to ensure that we do the right thing with unloadable shared objects. In case a shared object was unloaded that installed an atexit() hook the application would crash on exit. We now implement a callback into libroot that is used to call all the atexit() hooks of a component that is to be unloaded. Most prominently this fixes the media_server crash at shutdown. Modified: haiku/trunk/headers/private/kernel/user_runtime.h =================================================================== --- haiku/trunk/headers/private/kernel/user_runtime.h 2008-01-13 12:02:13 UTC (rev 23485) +++ haiku/trunk/headers/private/kernel/user_runtime.h 2008-01-13 12:08:34 UTC (rev 23486) @@ -41,6 +41,8 @@ status_t (*reinit_after_fork)(); + void (*call_atexit_hooks_for_range)(addr_t start, addr_t size); + const struct user_space_program_args *program_args; }; Modified: haiku/trunk/src/system/libroot/libroot_init.c =================================================================== --- haiku/trunk/src/system/libroot/libroot_init.c 2008-01-13 12:02:13 UTC (rev 23485) +++ haiku/trunk/src/system/libroot/libroot_init.c 2008-01-13 12:08:34 UTC (rev 23486) @@ -13,6 +13,8 @@ void initialize_before(image_id imageID); +void _call_atexit_hooks_for_range(addr_t start, addr_t size); +void __init_exit_stack_lock(); struct rld_export *__gRuntimeLoader = NULL; // This little bugger is set to something meaningful by the runtime loader @@ -48,6 +50,10 @@ __libc_argc = __gRuntimeLoader->program_args->arg_count; __libc_argv = __gRuntimeLoader->program_args->args; + __gRuntimeLoader->call_atexit_hooks_for_range + = _call_atexit_hooks_for_range; + + __init_exit_stack_lock(); __init_time(); __init_fork(); __init_heap(); Modified: haiku/trunk/src/system/libroot/posix/stdlib/exit.c =================================================================== --- haiku/trunk/src/system/libroot/posix/stdlib/exit.c 2008-01-13 12:02:13 UTC (rev 23485) +++ haiku/trunk/src/system/libroot/posix/stdlib/exit.c 2008-01-13 12:08:34 UTC (rev 23486) @@ -13,16 +13,94 @@ #include #include #include +#include extern void _IO_cleanup(void); extern void _thread_do_exit_notification(void); -static void (*sExitStack[ATEXIT_MAX])(void) = {0}; -static int32 sExitStackIndex = 0; +struct exit_stack_info { + void (*exit_stack[ATEXIT_MAX])(void); + int32 stack_size; + sem_id lock; + vint32 lock_count; + thread_id lock_owner; + size_t recursion_count; +}; +static struct exit_stack_info sExitStackInfo = { {}, 0, -1, 0, -1, 0 }; + + void +__init_exit_stack_lock() +{ + sExitStackInfo.lock = create_sem(0, "exit stack lock"); + if (sExitStackInfo.lock < 0) + debugger("failed to create exit stack lock"); +} + + +static void +_exit_stack_lock() +{ + thread_id self = find_thread(NULL); + if (self != sExitStackInfo.lock_owner) { + if (atomic_add(&sExitStackInfo.lock_count, 1) > 0) + acquire_sem(sExitStackInfo.lock); + sExitStackInfo.lock_owner = self; + } + sExitStackInfo.recursion_count++; +} + + +static void +_exit_stack_unlock() +{ + if (sExitStackInfo.lock_owner != find_thread(NULL)) + debugger("exit stack lock not owned"); + + if (sExitStackInfo.recursion_count-- == 1) { + sExitStackInfo.lock_owner = -1; + if (atomic_add(&sExitStackInfo.lock_count, -1) == 1) + release_sem(sExitStackInfo.lock); + } +} + + +void +_call_atexit_hooks_for_range(addr_t start, addr_t size) +{ + int32 index; + int32 insertIndex = -1; + + _exit_stack_lock(); + for (index = sExitStackInfo.stack_size - 1; index > 0; index--) { + addr_t function = (addr_t)sExitStackInfo.exit_stack[index]; + if (function >= start && function < start + size) { + (*sExitStackInfo.exit_stack[index])(); + sExitStackInfo.exit_stack[index] = NULL; + insertIndex = index; + } + } + + if (insertIndex >= 0) { + for (index = insertIndex + 1; + index < sExitStackInfo.stack_size; + index++) { + if (sExitStackInfo.exit_stack[index] != NULL) { + sExitStackInfo.exit_stack[insertIndex++] + = sExitStackInfo.exit_stack[index]; + } + } + sExitStackInfo.stack_size = insertIndex; + } + + _exit_stack_unlock(); +} + + +void abort() { fprintf(stderr, "Abort\n"); @@ -36,13 +114,16 @@ atexit(void (*func)(void)) { // push the function pointer onto the exit stack - int32 index = atomic_add(&sExitStackIndex, 1); + int result = -1; + _exit_stack_lock(); - if (index >= ATEXIT_MAX) - return -1; + if (sExitStackInfo.stack_size < ATEXIT_MAX) { + sExitStackInfo.exit_stack[sExitStackInfo.stack_size++] = func; + result = 0; + } - sExitStack[index] = func; - return 0; + _exit_stack_unlock(); + return result; } @@ -53,8 +134,10 @@ _thread_do_exit_notification(); // unwind the exit stack, calling the registered functions - while (sExitStackIndex-- > 0) - (*sExitStack[sExitStackIndex])(); + _exit_stack_lock(); + while (--sExitStackInfo.stack_size >= 0) + (*sExitStackInfo.exit_stack[sExitStackInfo.stack_size])(); + _exit_stack_unlock(); // close all open files _IO_cleanup(); Modified: haiku/trunk/src/system/runtime_loader/elf.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.cpp 2008-01-13 12:02:13 UTC (rev 23485) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2008-01-13 12:08:34 UTC (rev 23486) @@ -1458,6 +1458,11 @@ if (status == B_OK) { while ((image = sDisposableImages.head) != NULL) { // call image fini here... + if (gRuntimeLoader.call_atexit_hooks_for_range) { + gRuntimeLoader.call_atexit_hooks_for_range( + image->regions[0].start, image->regions[0].size); + } + if (image->term_routine) ((init_term_function)image->term_routine)(image->id); Modified: haiku/trunk/src/system/runtime_loader/export.c =================================================================== --- haiku/trunk/src/system/runtime_loader/export.c 2008-01-13 12:02:13 UTC (rev 23485) +++ haiku/trunk/src/system/runtime_loader/export.c 2008-01-13 12:08:34 UTC (rev 23486) @@ -36,7 +36,8 @@ test_executable, get_next_image_dependency, - elf_reinit_after_fork + elf_reinit_after_fork, + NULL // call_atexit_hooks_for_range }; From korli at mail.berlios.de Sun Jan 13 13:34:28 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 13 Jan 2008 13:34:28 +0100 Subject: [Haiku-commits] r23487 - haiku/trunk/src/add-ons/kernel/drivers/network/pegasus Message-ID: <200801131234.m0DCYSg5027504@sheep.berlios.de> Author: korli Date: 2008-01-13 13:34:27 +0100 (Sun, 13 Jan 2008) New Revision: 23487 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23487&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/network/pegasus/devlist.c Log: Fixed removing from device list with only one device info present Modified: haiku/trunk/src/add-ons/kernel/drivers/network/pegasus/devlist.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/pegasus/devlist.c 2008-01-13 12:08:34 UTC (rev 23486) +++ haiku/trunk/src/add-ons/kernel/drivers/network/pegasus/devlist.c 2008-01-13 12:34:27 UTC (rev 23487) @@ -48,9 +48,11 @@ acquire_sem(gDeviceListLock); - if (sDeviceList == device) + if (sDeviceList == device) { sDeviceList = device->next; - else { + --sDeviceCount; + gDeviceListChanged = true; + } else { pegasus_dev *previous; for (previous = sDeviceList; previous != NULL; previous = previous->next) { if (previous->next == device) { From korli at mail.berlios.de Sun Jan 13 13:35:08 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 13 Jan 2008 13:35:08 +0100 Subject: [Haiku-commits] r23488 - haiku/trunk/src/add-ons/kernel/drivers/midi/usb_midi Message-ID: <200801131235.m0DCZ8bP027600@sheep.berlios.de> Author: korli Date: 2008-01-13 13:35:08 +0100 (Sun, 13 Jan 2008) New Revision: 23488 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23488&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/midi/usb_midi/devlist.c haiku/trunk/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.c Log: Fixed removing from device list with only one device info present Modified: haiku/trunk/src/add-ons/kernel/drivers/midi/usb_midi/devlist.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/midi/usb_midi/devlist.c 2008-01-13 12:34:27 UTC (rev 23487) +++ haiku/trunk/src/add-ons/kernel/drivers/midi/usb_midi/devlist.c 2008-01-13 12:35:08 UTC (rev 23488) @@ -55,15 +55,14 @@ { assert (my_dev != NULL); acquire_sem (my_device_list_lock); - if (my_device_list == my_dev) + if (my_device_list == my_dev) { my_device_list = my_dev->next; - else - { + --my_device_count; + my_device_list_changed = true; + } else { my_device_info *d; - for (d = my_device_list; d != NULL; d = d->next) - { - if (d->next == my_dev) - { + for (d = my_device_list; d != NULL; d = d->next) { + if (d->next == my_dev) { d->next = my_dev->next; --my_device_count; my_device_list_changed = true; @@ -80,8 +79,7 @@ my_device_info *my_dev; acquire_sem (my_device_list_lock); - for (my_dev = my_device_list; my_dev != NULL; my_dev = my_dev->next) - { + for (my_dev = my_device_list; my_dev != NULL; my_dev = my_dev->next) { if (strcmp(my_dev->name, name) == 0) break; } @@ -104,8 +102,7 @@ void free_device_names (void) { - if (my_device_names != NULL) - { + if (my_device_names != NULL) { int i; for (i = 0; my_device_names [i] != NULL; i++) free (my_device_names [i]); @@ -121,8 +118,7 @@ assert (my_device_names != NULL); acquire_sem (my_device_list_lock); - for (i = 0, my_dev = my_device_list; my_dev != NULL; my_dev = my_dev->next) - { + for (i = 0, my_dev = my_device_list; my_dev != NULL; my_dev = my_dev->next) { my_device_names [i++] = strdup(my_dev->name); DPRINTF_INFO ((MY_ID "publishing %s\n", my_dev->name)); } Modified: haiku/trunk/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.c 2008-01-13 12:34:27 UTC (rev 23487) +++ haiku/trunk/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.c 2008-01-13 12:35:08 UTC (rev 23488) @@ -540,9 +540,9 @@ DPRINTF_INFO ((MY_ID "uninit_driver()\n")); usb->uninstall_notify (usb_midi_driver_name); - delete_sem (my_device_list_lock); - put_module (B_USB_MODULE_NAME); - free_device_names (); + delete_sem(my_device_list_lock); + put_module(B_USB_MODULE_NAME); + free_device_names(); } /* From mmu_man at mail.berlios.de Sun Jan 13 13:40:49 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 13 Jan 2008 13:40:49 +0100 Subject: [Haiku-commits] r23489 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801131240.m0DCenQa027967@sheep.berlios.de> Author: mmu_man Date: 2008-01-13 13:40:49 +0100 (Sun, 13 Jan 2008) New Revision: 23489 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23489&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S Log: * Fixes... it now builds and theorically should work, let's see... Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 12:35:08 UTC (rev 23488) +++ haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-13 12:40:49 UTC (rev 23489) @@ -33,7 +33,7 @@ // when the drive reading fails for some reason, it will // retry this many times until it will report a failure -.text +//.text /* main entry point, both from the floppy boot and .prg */ bra real_entry @@ -49,7 +49,7 @@ // first, determine if .prg (user) or bootsect (super) // Super() - move.l SUP_INQUIRE,-(%sp) + move.l #SUP_INQUIRE,-(%sp) move.w #0x20,%d0 trap #1 addq.l #6,%sp @@ -65,18 +65,20 @@ move.l #ATARI_ZBEOS_STACK_BASE,%sp //XXX: check for enough RAM // load the rest - move.w #sNumSectors,%d2 + move.w sNumSectors,%d2 // load at base + this code. move.l #ATARI_ZBEOS_BASE+512,%a2 bsr load_sectors tst.l %d0 beq floppy_done lea failure_string,%a0 - jsr puts + bsr puts bra spin -flopy_done: - bra #ATARI_ZBEOS_BASE+512 +floppy_done: + jmp ATARI_ZBEOS_BASE+512 + //rts + /** Loads %d2 sectors from floppy disk, starting at head XXX %dh, sector %cx. * The data is loaded to %a2. */ @@ -88,7 +90,7 @@ move.w #1,-(%sp) // 2nd sector move.w %d2,-(%sp) move.l %a2,-(%sp) - move.w RW_READ+RW_NOTRANSLATE,-(%sp) + move.w #RW_READ+RW_NOTRANSLATE,-(%sp) move.w #4,-(%sp) trap #13 add.l #14,%sp @@ -113,7 +115,7 @@ prg_start: // .prg: // we need to switch to supervisor mode anyway - move.l SUP_SET,-(%sp) + move.l #SUP_SET,-(%sp) move.w #0x20,%d0 trap #1 addq.l #6,%sp @@ -125,8 +127,8 @@ bra spin super_done: - - jsr _start + // XXX: copy the rest ! + jmp ATARI_ZBEOS_BASE+512 saved_super_stack: .long 0 @@ -179,7 +181,7 @@ .string "Unimplemented." shell_end: - .skip 0x01fe - tmp_floppy_end + .fill 0x01fe - tmp_floppy_end, 1, 0x55 // .org 0x01fe .word 0xaa55-1 // will be replaced by the one calculated by the build. // we make sure we PCs don't try to execute it. @@ -187,3 +189,4 @@ // expected by the BFS boot loader, and also marks // this block as valid boot block for the BIOS // XXX: actually TOS wants a real checksum here so sum is 0x1234! +tmp_floppy_end: From korli at mail.berlios.de Sun Jan 13 14:45:34 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 13 Jan 2008 14:45:34 +0100 Subject: [Haiku-commits] r23490 - haiku/trunk/src/add-ons/kernel/drivers/bus/pcmcia Message-ID: <200801131345.m0DDjYHU032568@sheep.berlios.de> Author: korli Date: 2008-01-13 14:45:34 +0100 (Sun, 13 Jan 2008) New Revision: 23490 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23490&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/pcmcia/ds.c Log: check the allocation of the name list use a macro get_handle Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/pcmcia/ds.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/pcmcia/ds.c 2008-01-13 12:40:49 UTC (rev 23489) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/pcmcia/ds.c 2008-01-13 13:45:34 UTC (rev 23490) @@ -22,6 +22,7 @@ #define copy_from_user memcpy #define copy_to_user memcpy #define CardServices gPcmciaCs->_CardServices +#define get_handle gPcmciaDs->get_handle const char sockname[] = "bus/pcmcia/sock/%ld"; static char ** devices; @@ -50,7 +51,7 @@ return B_BAD_VALUE; } - if (gPcmciaDs->get_handle(socket, (client_handle_t *)_cookie) != B_OK) { + if (get_handle(socket, (client_handle_t *)_cookie) != B_OK) { return ENODEV; } @@ -365,7 +366,7 @@ } devices_count = 0; - while (gPcmciaDs->get_handle(devices_count, &handle)==B_OK) { + while (get_handle(devices_count, &handle)==B_OK) { devices_count++; } @@ -376,6 +377,11 @@ } devices = malloc(sizeof(char *) * (devices_count+1)); + if (!devices) { + put_module(CS_CLIENT_MODULE_NAME); + put_module(DS_MODULE_NAME); + return ENOMEM; + } for (i=0; i Author: axeld Date: 2008-01-13 18:09:01 +0100 (Sun, 13 Jan 2008) New Revision: 23491 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23491&view=rev Modified: haiku/trunk/src/system/kernel/debug/tracing.cpp Log: * Fixed a bug in make_space() that would endlessly skip entries, even though there was nothing to do (if 'diff' was larger than 'needed'). * Improved KDL command output. * Added debug output to the allocation functions. * Minor cleanup. Modified: haiku/trunk/src/system/kernel/debug/tracing.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/tracing.cpp 2008-01-13 13:45:34 UTC (rev 23490) +++ haiku/trunk/src/system/kernel/debug/tracing.cpp 2008-01-13 17:09:01 UTC (rev 23491) @@ -7,6 +7,14 @@ #if ENABLE_TRACING +//#define TRACE_TRACING +#ifdef TRACE_TRACING +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + + enum { WRAP_ENTRY = 0x01, ENTRY_INITIALIZED = 0x02, @@ -45,24 +53,34 @@ sBufferEnd = sBuffer; } - int32 diff = sBufferStart - sBufferEnd; - if (diff < 0) + int32 space = (sBufferStart - sBufferEnd) * 4; + TRACE(("make_space(%lu), left %ld\n", needed, space)); + if (space < 0) sBufferEnd = sBuffer; + else if ((size_t)space < needed) + needed -= space; else - needed -= diff; + return; while (true) { + TraceEntry* removed = (TraceEntry*)sBufferStart; uint16 freed = sBufferStart->size; + TRACE((" skip start %p, %u bytes\n", sBufferStart, freed)); + sBufferStart = next_entry(sBufferStart); if (sBufferStart == NULL) sBufferStart = sBufferEnd; + sEntries--; + removed->~TraceEntry(); if (needed <= freed) break; needed -= freed; } + + TRACE((" out: start %p, entries %ld\n", sBufferStart, sEntries)); } @@ -76,9 +94,13 @@ size = (size + 3) & ~3; + TRACE(("allocate_entry(%lu), start %p, end %p, buffer %p\n", size, + sBufferStart, sBufferEnd, sBuffer)); + if (sBufferStart < sBufferEnd || sEntries == 0) { // the buffer ahead of us is still empty uint32 space = (sBuffer + kBufferSize - sBufferEnd) * 4; + TRACE((" free after end %p: %lu\n", sBufferEnd, space)); if (space < size) make_space(size); } else { @@ -91,6 +113,8 @@ entry->flags = 0; sBufferEnd += size >> 2; sEntries++; + TRACE((" entry: %p, end %p, start %p, entries %ld\n", entry, sBufferEnd, + sBufferStart, sEntries)); return entry; } @@ -167,12 +191,14 @@ kprintf("usage: %s [start] [count] [#pattern]\n", argv[0]); return 0; } - // TODO: add pattern matching mechanism for the class name if (start < 0) start = 0; + if (start + count > sEntries) + count = sEntries - start; int32 index = 0; + int32 dumped = 0; for (trace_entry* current = sBufferStart; current != NULL; current = next_entry(current), index++) { @@ -180,7 +206,7 @@ continue; if (index > start + count) break; - if ((entry->flags & BUFFER_ENTRY) != 0) { + if ((current->flags & BUFFER_ENTRY) != 0) { // skip buffer entries index--; continue; @@ -194,6 +220,8 @@ if (pattern != NULL && strstr(buffer, pattern) == NULL) continue; + dumped++; + if (pattern != NULL) kprintf("%5ld. %s\n", index, buffer); else @@ -202,7 +230,8 @@ kprintf("%5ld. ** uninitialized entry **\n", index); } - kprintf("%ld of %ld entries.\n", count, sEntries); + kprintf("%ld entries of entries %ld to %ld (total %ld).\n", dumped, + start + 1, start + count, sEntries); return 0; } @@ -232,10 +261,8 @@ area_id area = create_area("tracing log", (void**)&sBuffer, B_ANY_KERNEL_ADDRESS, MAX_TRACE_SIZE, B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); - if (area < B_OK) { - panic("OH"); + if (area < B_OK) return area; - } sBufferStart = sBuffer; sBufferEnd = sBuffer; From axeld at mail.berlios.de Sun Jan 13 18:18:30 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Jan 2008 18:18:30 +0100 Subject: [Haiku-commits] r23492 - in haiku/trunk: headers/os/drivers headers/private/fs_shell src/add-ons/kernel/file_systems/bfs src/system/kernel/cache src/tools/fs_shell Message-ID: <200801131718.m0DHIUcO014033@sheep.berlios.de> Author: axeld Date: 2008-01-13 18:18:29 +0100 (Sun, 13 Jan 2008) New Revision: 23492 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23492&view=rev Modified: haiku/trunk/headers/os/drivers/fs_cache.h haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h haiku/trunk/src/system/kernel/cache/block_cache.cpp haiku/trunk/src/tools/fs_shell/block_cache.cpp Log: * Added a transaction listener mechanism to be notified when a transaction ends or has been aborted. * BFS now listens for transactions when it created an inode to see if the transaction will be aborted without freeing the inode (in which case it will panic for now). * Started implementing tracing support, but it's not working yet. * Minor cleanup. Modified: haiku/trunk/headers/os/drivers/fs_cache.h =================================================================== --- haiku/trunk/headers/os/drivers/fs_cache.h 2008-01-13 17:09:01 UTC (rev 23491) +++ haiku/trunk/headers/os/drivers/fs_cache.h 2008-01-13 17:18:29 UTC (rev 23492) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007, Haiku Inc. All Rights Reserved. + * Copyright 2004-2008, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _FS_CACHE_H @@ -11,8 +11,15 @@ #include -typedef void (*transaction_notification_hook)(int32 id, void *data); +enum { + TRANSACTION_WRITTEN, + TRANSACTION_ABORTED, + TRANSACTION_ENDED +}; +typedef void (*transaction_notification_hook)(int32 id, int32 event, + void *data); + #ifdef __cplusplus extern "C" { #endif @@ -27,6 +34,10 @@ transaction_notification_hook hook, void *data); extern status_t cache_abort_sub_transaction(void *_cache, int32 id); extern status_t cache_start_sub_transaction(void *_cache, int32 id); +extern status_t cache_add_transaction_listener(void *_cache, int32 id, + transaction_notification_hook hook, void *data); +extern status_t cache_remove_transaction_listener(void *_cache, int32 id, + transaction_notification_hook hook, void *data); extern status_t cache_next_block_in_transaction(void *_cache, int32 id, uint32 *_cookie, off_t *_blockNumber, void **_data, void **_unchangedData); Modified: haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h =================================================================== --- haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h 2008-01-13 17:09:01 UTC (rev 23491) +++ haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h 2008-01-13 17:18:29 UTC (rev 23492) @@ -1,5 +1,5 @@ /* - * Copyright 2007, Ingo Weinhold, bonefish at cs.tu-berlin.de. + * Copyright 2007-2008, Ingo Weinhold, bonefish at cs.tu-berlin.de. * Distributed under the terms of the MIT License. */ #ifndef _FSSH_API_WRAPPER_H @@ -787,6 +787,10 @@ //////////////////////////////////////////////////////////////////////////////// // #pragma mark - fssh_fs_cache.h +#define TRANSACTION_WRITTEN FSSH_TRANSACTION_WRITTEN +#define TRANSACTION_ABORTED FSSH_TRANSACTION_ABORTED +#define TRANSACTION_ENDED FSSH_TRANSACTION_ENDED + #define transaction_notification_hook fssh_transaction_notification_hook /* transactions */ @@ -797,6 +801,8 @@ #define cache_detach_sub_transaction fssh_cache_detach_sub_transaction #define cache_abort_sub_transaction fssh_cache_abort_sub_transaction #define cache_start_sub_transaction fssh_cache_start_sub_transaction +#define cache_add_transaction_listener fssh_cache_add_transaction_listener +#define cache_remove_transaction_listener fssh_cache_remove_transaction_listener #define cache_next_block_in_transaction fssh_cache_next_block_in_transaction #define cache_blocks_in_transaction fssh_cache_blocks_in_transaction #define cache_blocks_in_sub_transaction fssh_cache_blocks_in_sub_transaction Modified: haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h =================================================================== --- haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h 2008-01-13 17:09:01 UTC (rev 23491) +++ haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h 2008-01-13 17:18:29 UTC (rev 23492) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007, Haiku Inc. All Rights Reserved. + * Copyright 2004-2008, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _FSSH_FS_CACHE_H @@ -11,8 +11,15 @@ #include "fssh_fs_interface.h" -typedef void (*fssh_transaction_notification_hook)(int32_t id, void *data); +enum { + FSSH_TRANSACTION_WRITTEN, + FSSH_TRANSACTION_ABORTED, + FSSH_TRANSACTION_ENDED +}; +typedef void (*fssh_transaction_notification_hook)(int32_t id, int32_t event, + void *data); + #ifdef __cplusplus extern "C" { #endif @@ -31,6 +38,12 @@ int32_t id); extern fssh_status_t fssh_cache_start_sub_transaction(void *_cache, int32_t id); +extern fssh_status_t fssh_cache_add_transaction_listener(void *_cache, + int32_t id, fssh_transaction_notification_hook hook, + void *data); +extern fssh_status_t fssh_cache_remove_transaction_listener(void *_cache, + int32_t id, fssh_transaction_notification_hook hook, + void *data); extern fssh_status_t fssh_cache_next_block_in_transaction(void *_cache, int32_t id, uint32_t *_cookie, fssh_off_t *_blockNumber, void **_data, Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-01-13 17:09:01 UTC (rev 23491) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-01-13 17:18:29 UTC (rev 23492) @@ -69,7 +69,7 @@ virtual void AddDump(char *buffer, size_t size) { - snprintf(buffer, size, "free %lu.%u.%u\n", fRun.AllocationGroup(), + snprintf(buffer, size, "free %lu.%u.%u", fRun.AllocationGroup(), fRun.Start(), fRun.Length()); } Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2008-01-13 17:09:01 UTC (rev 23491) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2008-01-13 17:18:29 UTC (rev 23492) @@ -39,7 +39,7 @@ virtual void AddDump(char *buffer, size_t size) { snprintf(buffer, size, "CREATE %Ld (%p), parent %Ld (%p), \"%s\", " - "mode %lx, omode %x, type %lx\n", fID, fInode, fParentID, + "mode %lx, omode %x, type %lx", fID, fInode, fParentID, fParent, fName, fMode, fOpenMode, fType); } @@ -92,7 +92,7 @@ virtual void AddDump(char *buffer, size_t size) { - snprintf(buffer, size, "RESIZE %Ld (%p), %Ld -> %Ld\n", fID, fInode, + snprintf(buffer, size, "RESIZE %Ld (%p), %Ld -> %Ld", fID, fInode, fOldSize, fNewSize); } @@ -115,11 +115,14 @@ InodeAllocator(Transaction &transaction); ~InodeAllocator(); - status_t New(block_run *parentRun, mode_t mode, block_run &run, Inode **_inode); + status_t New(block_run *parentRun, mode_t mode, block_run &run, + Inode **_inode); status_t CreateTree(); status_t Keep(); private: + static void _TransactionListener(int32 id, int32 event, void *_inode); + Transaction *fTransaction; block_run fRun; Inode *fInode; @@ -224,6 +227,11 @@ if (!fInode->IsSymLink() && volume->ID() >= 0) status = publish_vnode(volume->ID(), fInode->ID(), fInode); + if (status == B_OK) { + cache_add_transaction_listener(volume->BlockCache(), fTransaction->ID(), + &_TransactionListener, fInode); + } + fTransaction = NULL; fInode = NULL; @@ -231,6 +239,16 @@ } +/*static*/ void +InodeAllocator::_TransactionListener(int32 id, int32 event, void *_inode) +{ + Inode *inode = (Inode *)_inode; + + if (event == TRANSACTION_ABORTED) + panic("transaction %d aborted, inode %p still around!\n", (int)id, inode); +} + + // #pragma mark - Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-01-13 17:09:01 UTC (rev 23491) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-01-13 17:18:29 UTC (rev 23492) @@ -451,10 +451,13 @@ able to update the log start pointer. */ void -Journal::_blockNotify(int32 transactionID, void *arg) +Journal::_BlockNotify(int32 transactionID, int32 event, void *arg) { LogEntry *logEntry = (LogEntry *)arg; + if (event != TRANSACTION_WRITTEN) + return; + PRINT(("Log entry %p has been finished, transaction ID = %ld\n", logEntry, transactionID)); Journal *journal = logEntry->GetJournal(); @@ -495,7 +498,7 @@ status_t status = journal->fVolume->WriteSuperBlock(); if (status != B_OK) { - FATAL(("blockNotify: could not write back super block: %s\n", + FATAL(("_BlockNotify: could not write back super block: %s\n", strerror(status))); } } @@ -656,7 +659,7 @@ fUsed += logEntry->Length(); fEntriesLock.Unlock(); - cache_end_transaction(fVolume->BlockCache(), fTransactionID, _blockNotify, + cache_end_transaction(fVolume->BlockCache(), fTransactionID, _BlockNotify, logEntry); // If the log goes to the next round (the log is written as a Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h 2008-01-13 17:09:01 UTC (rev 23491) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h 2008-01-13 17:18:29 UTC (rev 23492) @@ -59,7 +59,7 @@ status_t _CheckRunArray(const run_array *array); status_t _ReplayRunArray(int32 *start); status_t _TransactionDone(bool success); - static void _blockNotify(int32 transactionID, void *arg); + static void _BlockNotify(int32 transactionID, int32 event, void *arg); Volume *fVolume; RecursiveLock fLock; Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-01-13 17:09:01 UTC (rev 23491) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-01-13 17:18:29 UTC (rev 23492) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -41,11 +42,64 @@ #define DEBUG_BLOCK_CACHE //#define DEBUG_CHANGED +//#define TRANSACTION_TRACING // This macro is used for fatal situations that are acceptable in a running // system, like out of memory situations - should only panic for debugging. #define FATAL(x) panic x +#ifdef TRANSACTION_TRACING +namespace TransactionTracing { + +class Start : public AbstractTraceEntry { + public: + Start(cache_transaction *transaction) + : + fTransaction(transaction) + { + Initialized(); + } + + virtual void AddDump(char *buffer, size_t size) + { + } + + private: + cache_transaction *fTransaction; +}; + +class Cancel : public AbstractTraceEntry { + public: + Cancel(cache_transaction *transaction) + : + fTransaction(transaction) + { + Initialized(); + } + + virtual void AddDump(char *buffer, size_t size) + { + } + + private: + cache_transaction *fTransaction; +}; + +} // namespace TransactionTracing + +# define T(x) new(std::nothrow) TransactionTracing::x; +#else +# define T(x) ; +#endif + + +struct cache_hook : DoublyLinkedListLinkImpl { + transaction_notification_hook hook; + void *data; +}; + +typedef DoublyLinkedList HookList; + struct cache_transaction { cache_transaction(); @@ -57,6 +111,7 @@ block_list blocks; transaction_notification_hook notification_hook; void *notification_data; + HookList listeners; bool open; bool has_sub_transaction; }; @@ -108,7 +163,25 @@ } +/*! Notifies all listeners of this transaction, and removes them + afterwards. +*/ static void +notify_transaction_listeners(cache_transaction *transaction, int32 event) +{ + HookList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_hook *hook = iterator.Next(); + + hook->hook(transaction->id, event, hook->data); + + iterator.Remove(); + delete hook; + } +} + + +static void delete_transaction(block_cache *cache, cache_transaction *transaction) { if (cache->last_transaction == transaction) @@ -712,7 +785,7 @@ TRACE(("cache transaction %ld finished!\n", previous->id)); if (previous->notification_hook != NULL) { - previous->notification_hook(previous->id, + previous->notification_hook(previous->id, TRANSACTION_WRITTEN, previous->notification_data); } @@ -900,6 +973,8 @@ transaction->notification_hook = hook; transaction->notification_data = data; + notify_transaction_listeners(transaction, TRANSACTION_ENDED); + // iterate through all blocks and free the unchanged original contents cached_block *block = transaction->first_block, *next; @@ -949,6 +1024,8 @@ return B_BAD_VALUE; } + notify_transaction_listeners(transaction, TRANSACTION_ABORTED); + // iterate through all blocks and restore their original contents cached_block *block = transaction->first_block, *next; @@ -1010,6 +1087,8 @@ transaction->notification_hook = hook; transaction->notification_data = data; + notify_transaction_listeners(transaction, TRANSACTION_ENDED); + // iterate through all blocks and free the unchanged original contents cached_block *block = transaction->first_block, *next, *last = NULL; @@ -1074,6 +1153,8 @@ if (!transaction->has_sub_transaction) return B_BAD_VALUE; + notify_transaction_listeners(transaction, TRANSACTION_ABORTED); + // revert all changes back to the version of the parent cached_block *block = transaction->first_block, *next; @@ -1118,6 +1199,8 @@ return B_BAD_VALUE; } + notify_transaction_listeners(transaction, TRANSACTION_ENDED); + // move all changed blocks up to the parent cached_block *block = transaction->first_block, *next; @@ -1145,6 +1228,62 @@ } +/*! Adds a transaction listener that gets notified when the transaction + is ended or aborted. + The listener gets automatically removed in this case. +*/ +status_t +cache_add_transaction_listener(void *_cache, int32 id, + transaction_notification_hook hookFunction, void *data) +{ + block_cache *cache = (block_cache *)_cache; + + cache_hook *hook = new(std::nothrow) cache_hook; + if (hook == NULL) + return B_NO_MEMORY; + + BenaphoreLocker locker(&cache->lock); + + cache_transaction *transaction = lookup_transaction(cache, id); + if (transaction == NULL) { + delete hook; + return B_BAD_VALUE; + } + + hook->hook = hookFunction; + hook->data = data; + + transaction->listeners.Add(hook); + return B_OK; +} + + +status_t +cache_remove_transaction_listener(void *_cache, int32 id, + transaction_notification_hook hookFunction, void *data) +{ + block_cache *cache = (block_cache *)_cache; + + BenaphoreLocker locker(&cache->lock); + + cache_transaction *transaction = lookup_transaction(cache, id); + if (transaction == NULL) + return B_BAD_VALUE; + + HookList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_hook *hook = iterator.Next(); + if (hook->data == data && hook->hook == hookFunction) { + iterator.Remove(); + delete hook; + return B_OK; + } + } + + return B_ENTRY_NOT_FOUND; +} + + extern "C" status_t cache_next_block_in_transaction(void *_cache, int32 id, uint32 *_cookie, off_t *_blockNumber, void **_data, void **_unchangedData) Modified: haiku/trunk/src/tools/fs_shell/block_cache.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/block_cache.cpp 2008-01-13 17:09:01 UTC (rev 23491) +++ haiku/trunk/src/tools/fs_shell/block_cache.cpp 2008-01-13 17:18:29 UTC (rev 23492) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -45,7 +45,13 @@ static const int32_t kMaxBlockCount = 1024; +struct cache_hook : DoublyLinkedListLinkImpl { + fssh_transaction_notification_hook hook; + void *data; +}; +typedef DoublyLinkedList HookList; + struct cache_transaction { cache_transaction(); @@ -57,6 +63,7 @@ block_list blocks; fssh_transaction_notification_hook notification_hook; void *notification_data; + HookList listeners; bool open; bool has_sub_transaction; }; @@ -102,7 +109,25 @@ } +/*! Notifies all listeners of this transaction, and removes them + afterwards. +*/ static void +notify_transaction_listeners(cache_transaction *transaction, int32_t event) +{ + HookList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_hook *hook = iterator.Next(); + + hook->hook(transaction->id, event, hook->data); + + iterator.Remove(); + delete hook; + } +} + + +static void delete_transaction(block_cache *cache, cache_transaction *transaction) { if (cache->last_transaction == transaction) @@ -570,7 +595,7 @@ if (previous->notification_hook != NULL) { previous->notification_hook(previous->id, - previous->notification_data); + FSSH_TRANSACTION_WRITTEN, previous->notification_data); } if (deleteTransaction) { @@ -678,6 +703,8 @@ transaction->notification_hook = hook; transaction->notification_data = data; + notify_transaction_listeners(transaction, FSSH_TRANSACTION_ENDED); + // iterate through all blocks and free the unchanged original contents cached_block *block = transaction->first_block, *next; @@ -727,6 +754,8 @@ return FSSH_B_BAD_VALUE; } + notify_transaction_listeners(transaction, FSSH_TRANSACTION_ABORTED); + // iterate through all blocks and restore their original contents cached_block *block = transaction->first_block, *next; @@ -788,6 +817,8 @@ transaction->notification_hook = hook; transaction->notification_data = data; + notify_transaction_listeners(transaction, FSSH_TRANSACTION_ENDED); + // iterate through all blocks and free the unchanged original contents cached_block *block = transaction->first_block, *next, *last = NULL; @@ -852,6 +883,8 @@ if (!transaction->has_sub_transaction) return FSSH_B_BAD_VALUE; + notify_transaction_listeners(transaction, FSSH_TRANSACTION_ABORTED); + // revert all changes back to the version of the parent cached_block *block = transaction->first_block, *next; @@ -896,6 +929,8 @@ return FSSH_B_BAD_VALUE; } + notify_transaction_listeners(transaction, FSSH_TRANSACTION_ENDED); + // move all changed blocks up to the parent cached_block *block = transaction->first_block, *next; @@ -923,7 +958,63 @@ } +/*! Adds a transaction listener that gets notified when the transaction + is ended or aborted. + The listener gets automatically removed in this case. +*/ fssh_status_t +fssh_cache_add_transaction_listener(void *_cache, int32_t id, + fssh_transaction_notification_hook hookFunction, void *data) +{ + block_cache *cache = (block_cache *)_cache; + + cache_hook *hook = new(std::nothrow) cache_hook; + if (hook == NULL) + return FSSH_B_NO_MEMORY; + + BenaphoreLocker locker(&cache->lock); + + cache_transaction *transaction = lookup_transaction(cache, id); + if (transaction == NULL) { + delete hook; + return FSSH_B_BAD_VALUE; + } + + hook->hook = hookFunction; + hook->data = data; + + transaction->listeners.Add(hook); + return FSSH_B_OK; +} + + +fssh_status_t +fssh_cache_remove_transaction_listener(void *_cache, int32_t id, + fssh_transaction_notification_hook hookFunction, void *data) +{ + block_cache *cache = (block_cache *)_cache; + + BenaphoreLocker locker(&cache->lock); + + cache_transaction *transaction = lookup_transaction(cache, id); + if (transaction == NULL) + return FSSH_B_BAD_VALUE; + + HookList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_hook *hook = iterator.Next(); + if (hook->data == data && hook->hook == hookFunction) { + iterator.Remove(); + delete hook; + return FSSH_B_OK; + } + } + + return FSSH_B_ENTRY_NOT_FOUND; +} + + +fssh_status_t fssh_cache_next_block_in_transaction(void *_cache, int32_t id, uint32_t *_cookie, fssh_off_t *_blockNumber, void **_data, void **_unchangedData) { From mmlr at mail.berlios.de Sun Jan 13 19:49:28 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 13 Jan 2008 19:49:28 +0100 Subject: [Haiku-commits] r23493 - in haiku/trunk/src/system: libroot/posix/stdlib runtime_loader Message-ID: <200801131849.m0DInSW5005614@sheep.berlios.de> Author: mmlr Date: 2008-01-13 19:49:27 +0100 (Sun, 13 Jan 2008) New Revision: 23493 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23493&view=rev Modified: haiku/trunk/src/system/libroot/posix/stdlib/exit.c haiku/trunk/src/system/runtime_loader/elf.cpp Log: Fix the static cleanup mechanism introduced to the runtime_loader/libroot: * Fixed wrong start and size used in the runtime_loader * Fixed off by one error in the matching loop of the cleanup hook * Make sure we successfully acquire the locking sem of the exit stack Modified: haiku/trunk/src/system/libroot/posix/stdlib/exit.c =================================================================== --- haiku/trunk/src/system/libroot/posix/stdlib/exit.c 2008-01-13 17:18:29 UTC (rev 23492) +++ haiku/trunk/src/system/libroot/posix/stdlib/exit.c 2008-01-13 18:49:27 UTC (rev 23493) @@ -46,8 +46,10 @@ { thread_id self = find_thread(NULL); if (self != sExitStackInfo.lock_owner) { - if (atomic_add(&sExitStackInfo.lock_count, 1) > 0) - acquire_sem(sExitStackInfo.lock); + if (atomic_add(&sExitStackInfo.lock_count, 1) > 0) { + while (acquire_sem(sExitStackInfo.lock) != B_OK) + ; + } sExitStackInfo.lock_owner = self; } sExitStackInfo.recursion_count++; @@ -75,7 +77,7 @@ int32 insertIndex = -1; _exit_stack_lock(); - for (index = sExitStackInfo.stack_size - 1; index > 0; index--) { + for (index = sExitStackInfo.stack_size - 1; index >= 0; index--) { addr_t function = (addr_t)sExitStackInfo.exit_stack[index]; if (function >= start && function < start + size) { (*sExitStackInfo.exit_stack[index])(); Modified: haiku/trunk/src/system/runtime_loader/elf.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.cpp 2008-01-13 17:18:29 UTC (rev 23492) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2008-01-13 18:49:27 UTC (rev 23493) @@ -1460,7 +1460,7 @@ // call image fini here... if (gRuntimeLoader.call_atexit_hooks_for_range) { gRuntimeLoader.call_atexit_hooks_for_range( - image->regions[0].start, image->regions[0].size); + image->regions[0].vmstart, image->regions[0].vmsize); } if (image->term_routine) From mmlr at mail.berlios.de Sun Jan 13 19:49:39 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 13 Jan 2008 19:49:39 +0100 Subject: [Haiku-commits] r23494 - haiku/trunk/src/system/kernel/fs Message-ID: <200801131849.m0DIndno005664@sheep.berlios.de> Author: mmlr Date: 2008-01-13 19:49:39 +0100 (Sun, 13 Jan 2008) New Revision: 23494 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23494&view=rev Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp Log: Implemented driver unloading. When a driver is rescaned and doesn't publish any devices anymore it gets unloaded. Also made sure the function pointers are properly initialized and disabled debug output. Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/devfs.cpp 2008-01-13 18:49:27 UTC (rev 23493) +++ haiku/trunk/src/system/kernel/fs/devfs.cpp 2008-01-13 18:49:39 UTC (rev 23494) @@ -134,6 +134,8 @@ int32 *api_version; device_hooks *(*find_device)(const char *); const char **(*publish_devices)(void); + status_t (*uninit_driver)(void); + status_t (*uninit_hardware)(void); }; @@ -256,13 +258,18 @@ goto error2; } + // resolve and cache those for the driver unload code + if (get_image_symbol(image, "uninit_driver", B_SYMBOL_TYPE_TEXT, + (void **)&driver->uninit_driver) != B_OK) + driver->uninit_driver = NULL; + if (get_image_symbol(image, "uninit_hardware", B_SYMBOL_TYPE_TEXT, + (void **)&driver->uninit_hardware) != B_OK) + driver->uninit_hardware = NULL; + // The driver has successfully been initialized, now we can // finally publish its device entries // we keep the driver loaded if it exports at least a single interface - // ToDo: we could/should always unload drivers until they will be used for real - // ToDo: this function is probably better kept in devfs, so that it could remember - // the driver stuff (and even keep it loaded if there is enough memory) devicePaths = driver->publish_devices(); if (devicePaths == NULL) { dprintf("%s: publish_devices() returned NULL.\n", name); @@ -279,7 +286,7 @@ exported++; } - // we're all done, driver will be kept loaded (for now, see above comment) + // we're all done, driver will be kept loaded if (exported > 0) { driver->image = image; return B_OK; @@ -288,20 +295,12 @@ status = B_ERROR; // whatever... error3: - { - status_t (*uninit_driver)(void); - if (get_image_symbol(image, "uninit_driver", B_SYMBOL_TYPE_TEXT, - (void **)&uninit_driver) == B_OK) - uninit_driver(); - } + if (driver->uninit_driver) + driver->uninit_driver(); error2: - { - status_t (*uninit_hardware)(void); - if (get_image_symbol(image, "uninit_hardware", B_SYMBOL_TYPE_TEXT, - (void **)&uninit_hardware) == B_OK) - uninit_hardware(); - } + if (driver->uninit_hardware) + driver->uninit_hardware(); error1: if (driver->image < 0) { @@ -313,7 +312,27 @@ } -static status_t +static status_t +unload_driver(driver_entry *driver) +{ + if (driver->image < 0) { + // driver is not currently loaded + return B_NO_INIT; + } + + if (driver->uninit_driver) + driver->uninit_driver(); + + if (driver->uninit_hardware) + driver->uninit_hardware(); + + unload_kernel_add_on(driver->image); + driver->image = -1; + return B_OK; +} + + +static status_t add_driver(const char *path, image_id image) { // see if we already know this driver @@ -361,6 +380,12 @@ driver->image = image; driver->last_modified = stat.st_mtime; + driver->api_version = NULL; + driver->find_device = NULL; + driver->publish_devices = NULL; + driver->uninit_driver = NULL; + driver->uninit_hardware = NULL; + hash_insert(sDeviceFileSystem->driver_hash, driver); // Even if loading the driver fails - its entry will stay with us @@ -1059,7 +1084,7 @@ if (hooks == NULL) continue; - dprintf("devfs: publishing new device \"%s\"\n", devicePaths[0]); + TRACE(("devfs: publishing new device \"%s\"\n", devicePaths[0])); if (publish_device(sDeviceFileSystem, devicePaths[0], NULL, NULL, driver, hooks, *driver->api_version) == B_OK) exported++; @@ -1068,7 +1093,7 @@ // what's left in currentNodes was present but is not anymore -> unpublish node_path_entry *entry = currentNodes.Head(); while (entry) { - dprintf("devfs: unpublishing no more present \"%s\"\n", entry->path); + TRACE(("devfs: unpublishing no more present \"%s\"\n", entry->path)); devfs_unpublish_device(entry->path, true); node_path_entry *next = currentNodes.GetNext(entry); currentNodes.Remove(entry); @@ -1077,8 +1102,8 @@ } if (exported == 0) { - dprintf("devfs: driver \"%s\" does not publish any more nodes and could be unloaded\n", driver->path); - // ToDo: here we could unload the driver if it doesn't publish anything + TRACE(("devfs: driver \"%s\" does not publish any more nodes and is unloaded\n", driver->path)); + unload_driver(driver); } return B_OK; From korli at mail.berlios.de Sun Jan 13 20:43:00 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 13 Jan 2008 20:43:00 +0100 Subject: [Haiku-commits] r23495 - haiku/trunk/src/apps/codycam Message-ID: <200801131943.m0DJh0EH009657@sheep.berlios.de> Author: korli Date: 2008-01-13 20:43:00 +0100 (Sun, 13 Jan 2008) New Revision: 23495 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23495&view=rev Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp haiku/trunk/src/apps/codycam/VideoConsumer.cpp Log: fixed warnings Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp =================================================================== --- haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-01-13 18:49:39 UTC (rev 23494) +++ haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-01-13 19:43:00 UTC (rev 23495) @@ -600,7 +600,7 @@ if (control != NULL) { int32 client; message->FindInt32("client", &(fFtpInfo.uploadClient)); - FTPINFO("upl client = %d\n", fFtpInfo.uploadClient); + FTPINFO("upl client = %ld\n", fFtpInfo.uploadClient); } break; Modified: haiku/trunk/src/apps/codycam/VideoConsumer.cpp =================================================================== --- haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-01-13 18:49:39 UTC (rev 23494) +++ haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-01-13 19:43:00 UTC (rev 23495) @@ -688,7 +688,7 @@ ftp = new SftpClient; break; default: - fprintf(stderr, "invalid upload client %d\n", fUploadClient); + fprintf(stderr, "invalid upload client %ld\n", fUploadClient); return EINVAL; } From axeld at mail.berlios.de Sun Jan 13 21:08:46 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Jan 2008 21:08:46 +0100 Subject: [Haiku-commits] r23496 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200801132008.m0DK8kHW013038@sheep.berlios.de> Author: axeld Date: 2008-01-13 21:08:43 +0100 (Sun, 13 Jan 2008) New Revision: 23496 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23496&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp Log: Added a bit more tracing output to the block allocations. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-01-13 19:43:00 UTC (rev 23495) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-01-13 20:08:43 UTC (rev 23496) @@ -77,6 +77,53 @@ block_run fRun; }; + +static uint32 +checksum(const uint8 *data, size_t size) +{ + const uint32 *data4 = (const uint32 *)data; + uint32 sum = 0; + while (size >= 4) { + sum += *data4; + data4++; + size -= 4; + } + return sum; +} + + +class Block : public AbstractTraceEntry { + public: + Block(const char *label, off_t blockNumber, const uint8 *data, + size_t size) + : + fBlock(blockNumber), + fData(data) + { + strlcpy(fLabel, label, sizeof(fLabel)); + fSum = checksum(data, size); + memcpy(fBytes, data, min_c(size, sizeof(fBytes))); + Initialized(); + } + + virtual void AddDump(char *buffer, size_t size) + { + uint32 length = snprintf(buffer, size, "%s: block %Ld (%p), sum %lu," + " bytes ", fLabel, fBlock, fData, fSum); + for (uint32 i = 0; length < size - 1 && i < sizeof(fBytes); i++) { + length += snprintf(buffer + length, size - length, "%02x", + fBytes[i]); + } + } + + private: + off_t fBlock; + const uint8 *fData; + uint32 fSum; + char fLabel[12]; + uint8 fBytes[32]; +}; + } // namespace BFSBlockTracing # define T(x) new(std::nothrow) BFSBlockTracing::x; @@ -109,6 +156,7 @@ uint32 NumBlockBits() const { return fNumBits; } uint32 &Block(int32 index) { return ((uint32 *)fBlock)[index]; } + uint8 *Block() const { return (uint8 *)fBlock; } private: uint32 fNumBits; @@ -375,6 +423,7 @@ if (cached.SetToWritable(transaction, *this, block) < B_OK) RETURN_ERROR(B_IO_ERROR); + T(Block("free-1", block, cached.Block(), volume->BlockSize())); uint16 freeLength = length; if (uint32(start + length) > cached.NumBlockBits()) freeLength = cached.NumBlockBits() - start; @@ -383,6 +432,7 @@ length -= freeLength; start = 0; + T(Block("free-2", block, cached.Block(), volume->BlockSize())); block++; } return B_OK; @@ -632,6 +682,8 @@ if (cached.SetTo(fGroups[group], block) < B_OK) RETURN_ERROR(B_ERROR); + T(Block("alloc-in", block, cached.Block(), fVolume->BlockSize())); + // find a block large enough to hold the allocation for (uint32 bit = start % cached.NumBlockBits(); bit < cached.NumBlockBits(); bit++) { @@ -680,6 +732,8 @@ // fixed anyway. T(Allocate(run)); + T(Block("alloc-out", block, cached.Block(), + fVolume->BlockSize())); return B_OK; } From colacoder at mail.berlios.de Sun Jan 13 21:46:33 2008 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Sun, 13 Jan 2008 21:46:33 +0100 Subject: [Haiku-commits] r23497 - haiku/trunk/src/add-ons/kernel/generic/scsi_periph Message-ID: <200801132046.m0DKkXg1015566@sheep.berlios.de> Author: colacoder Date: 2008-01-13 21:46:32 +0100 (Sun, 13 Jan 2008) New Revision: 23497 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23497&view=rev Modified: haiku/trunk/src/add-ons/kernel/generic/scsi_periph/device.c Log: Make (S)ATA(PI) drives publish under /dev/disk/ata[pi] again Modified: haiku/trunk/src/add-ons/kernel/generic/scsi_periph/device.c =================================================================== --- haiku/trunk/src/add-ons/kernel/generic/scsi_periph/device.c 2008-01-13 20:08:43 UTC (rev 23496) +++ haiku/trunk/src/add-ons/kernel/generic/scsi_periph/device.c 2008-01-13 20:46:32 UTC (rev 23497) @@ -35,7 +35,6 @@ // IDE devices have a different naming scheme if (pnp->get_attr_uint32(node, "ide/channel_id", &channel, true) == B_OK - && pnp->get_attr_uint8(node, "ide_adapter/is_primary", &isPrimary, true) == B_OK && pnp->get_attr_uint8(node, SCSI_DEVICE_TYPE_ITEM, &type, true) == B_OK) { // this is actually an IDE device, so we ignore the prefix From bonefish at mail.berlios.de Sun Jan 13 22:07:15 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 13 Jan 2008 22:07:15 +0100 Subject: [Haiku-commits] r23498 - haiku/trunk/src/apps/processcontroller Message-ID: <200801132107.m0DL7Fhe016887@sheep.berlios.de> Author: bonefish Date: 2008-01-13 22:07:14 +0100 (Sun, 13 Jan 2008) New Revision: 23498 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23498&view=rev Modified: haiku/trunk/src/apps/processcontroller/AutoIcon.cpp haiku/trunk/src/apps/processcontroller/AutoIcon.h haiku/trunk/src/apps/processcontroller/IconMenuItem.cpp haiku/trunk/src/apps/processcontroller/IconMenuItem.h haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.h haiku/trunk/src/apps/processcontroller/MemoryBarMenu.cpp haiku/trunk/src/apps/processcontroller/MemoryBarMenu.h haiku/trunk/src/apps/processcontroller/MemoryBarMenuItem.cpp haiku/trunk/src/apps/processcontroller/NoiseBarMenuItem.cpp haiku/trunk/src/apps/processcontroller/NoiseBarMenuItem.h haiku/trunk/src/apps/processcontroller/PCWindow.cpp haiku/trunk/src/apps/processcontroller/PCWorld.cpp haiku/trunk/src/apps/processcontroller/Preferences.cpp haiku/trunk/src/apps/processcontroller/Preferences.h haiku/trunk/src/apps/processcontroller/ProcessController.cpp haiku/trunk/src/apps/processcontroller/QuitMenu.h haiku/trunk/src/apps/processcontroller/TeamBarMenu.cpp haiku/trunk/src/apps/processcontroller/TeamBarMenuItem.cpp haiku/trunk/src/apps/processcontroller/TeamBarMenuItem.h haiku/trunk/src/apps/processcontroller/ThreadBarMenuItem.cpp Log: Patch by Vasilis Kaoutsis: * Style cleanup. * Renamed class GebsPreferences to Preferences. * Made NoiseBarMenuItem::fBusyWaiting/fLost private and added getters and setters. Modified: haiku/trunk/src/apps/processcontroller/AutoIcon.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/AutoIcon.cpp 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/AutoIcon.cpp 2008-01-13 21:07:14 UTC (rev 23498) @@ -34,13 +34,13 @@ BBitmap* -AutoIcon::bitmap() +AutoIcon::Bitmap() { if (fBitmap == NULL) { #ifdef HAIKU_TARGET_PLATFORM_HAIKU - fBitmap = new BBitmap (BRect (0, 0, 15, 15), B_RGBA32); + fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_RGBA32); #else - fBitmap = new BBitmap (BRect (0, 0, 15, 15), B_CMAP8); + fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8); #endif if (fSignature) { entry_ref ref; @@ -48,9 +48,9 @@ if (BNodeInfo::GetTrackerIcon(&ref, fBitmap, B_MINI_ICON) != B_OK) fBitmap->SetBits(k_app_mini, 256, 0, B_CMAP8); } + if (fbits) - fBitmap->SetBits (fbits, 256, 0, B_CMAP8); + fBitmap->SetBits(fbits, 256, 0, B_CMAP8); } return fBitmap; } - Modified: haiku/trunk/src/apps/processcontroller/AutoIcon.h =================================================================== --- haiku/trunk/src/apps/processcontroller/AutoIcon.h 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/AutoIcon.h 2008-01-13 21:07:14 UTC (rev 23498) @@ -28,18 +28,34 @@ class AutoIcon { public: AutoIcon(const char* signature) - : fSignature (signature), fbits (0), fBitmap (0) {} + : + fSignature(signature), + fbits(0), + fBitmap(0) + { + } + AutoIcon(const uchar* bits) - : fSignature (0), fbits (bits), fBitmap (0) {} + : + fSignature(0), + fbits(bits), + fBitmap(0) + { + } + ~AutoIcon(); - operator BBitmap*() { return bitmap(); } - BBitmap* bitmap(); + operator BBitmap*() + { + return Bitmap(); + } + BBitmap* Bitmap(); + private: const char* fSignature; const uchar* fbits; - BBitmap * fBitmap; + BBitmap* fBitmap; }; #endif // _AUTO_ICON_H_ Modified: haiku/trunk/src/apps/processcontroller/IconMenuItem.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/IconMenuItem.cpp 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/IconMenuItem.cpp 2008-01-13 21:07:14 UTC (rev 23498) @@ -29,44 +29,47 @@ #include #include -// -------------------------------------------------------------- IconMenuItem::IconMenuItem(BBitmap* icon, const char* title, - BMessage* msg, bool drawText, bool purge) - :BMenuItem(title, msg), fIcon(icon), fDrawText(drawText), fPurge(purge) - + BMessage* msg, bool drawText, bool purge) + : BMenuItem(title, msg), + fIcon(icon), + fDrawText(drawText), + fPurge(purge) { if (!fIcon) DefaultIcon(NULL); } -// -------------------------------------------------------------- IconMenuItem::IconMenuItem(BBitmap* icon, BMenu* menu, bool drawText, bool purge) - :BMenuItem(menu), fIcon(icon), fDrawText(drawText), fPurge(purge) + : BMenuItem(menu), + fIcon(icon), + fDrawText(drawText), + fPurge(purge) { if (!fIcon) DefaultIcon(NULL); } -// -------------------------------------------------------------- IconMenuItem::IconMenuItem(const char* mime, const char* title, BMessage* msg, bool drawText) - :BMenuItem(title, msg), fIcon(NULL), fDrawText(drawText) - + : BMenuItem(title, msg), + fIcon(NULL), + fDrawText(drawText) { DefaultIcon(mime); } -// -------------------------------------------------------------- + IconMenuItem::~IconMenuItem() { if (fPurge && fIcon) delete fIcon; } -// -------------------------------------------------------------- + void IconMenuItem::DrawContent() { BPoint loc; @@ -80,15 +83,17 @@ } } -// -------------------------------------------------------------- -void IconMenuItem::Highlight(bool hilited) + +void +IconMenuItem::Highlight(bool hilited) { BMenuItem::Highlight(hilited); DrawIcon(); } -// -------------------------------------------------------------- -void IconMenuItem::DrawIcon() + +void +IconMenuItem::DrawIcon() { // TODO: exact code duplication with TeamBarMenuItem::DrawIcon() if (!fIcon) @@ -112,8 +117,9 @@ menu->SetDrawingMode(B_OP_COPY); } -// -------------------------------------------------------------- -void IconMenuItem::GetContentSize(float* width, float* height) + +void +IconMenuItem::GetContentSize(float* width, float* height) { BMenuItem::GetContentSize(width, height); int limit = IconMenuItem::MinHeight(); @@ -125,25 +131,26 @@ *width = 16; } -// -------------------------------------------------------------- -void IconMenuItem::DefaultIcon(const char* mime) + +void +IconMenuItem::DefaultIcon(const char* mime) { - BRect r(0, 0, 15, 15); - fIcon = new BBitmap(r, B_COLOR_8_BIT); + BRect rect(0, 0, 15, 15); + fIcon = new BBitmap(rect, B_COLOR_8_BIT); if (mime) { - BMimeType mimeType(mime); - if (mimeType.GetIcon(fIcon, B_MINI_ICON)!=B_OK) + BMimeType mimeType(mime); + if (mimeType.GetIcon(fIcon, B_MINI_ICON) != B_OK) fDrawText = true; } else { - app_info info; + app_info info; be_app->GetAppInfo(&info); - if (BNodeInfo::GetTrackerIcon(&info.ref, fIcon, B_MINI_ICON)!=B_OK) + if (BNodeInfo::GetTrackerIcon(&info.ref, fIcon, B_MINI_ICON) != B_OK) fDrawText = true; } fPurge = true; } -// -------------------------------------------------------------- + int IconMenuItem::MinHeight() { static int minheight = -1; @@ -152,17 +159,18 @@ return minheight; } -// -------------------------------------------------------------- -bool before_dano() + +bool +before_dano() { - static int old_version = -1; - if (old_version < 0) - { + static int old_version = -1; + if (old_version < 0) { system_info sys_info; get_system_info(&sys_info); - time_t kernelTime = parsedate(sys_info.kernel_build_date, time(NULL)); - struct tm * date = gmtime(&kernelTime); + time_t kernelTime = parsedate(sys_info.kernel_build_date, time(NULL)); + struct tm* date = gmtime(&kernelTime); old_version = (date->tm_year < 101 || date->tm_year == 101 && date->tm_mon < 10); } + return old_version; } Modified: haiku/trunk/src/apps/processcontroller/IconMenuItem.h =================================================================== --- haiku/trunk/src/apps/processcontroller/IconMenuItem.h 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/IconMenuItem.h 2008-01-13 21:07:14 UTC (rev 23498) @@ -21,38 +21,40 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef _ICON_MENU_ITEM_H_ #define _ICON_MENU_ITEM_H_ #include + class BBitmap; -//--------------------------------------------------------------- class IconMenuItem : public BMenuItem { + public: + IconMenuItem(BBitmap*, const char* title, + BMessage*, bool drawText = true, bool purge = false); -public: - IconMenuItem(BBitmap*, const char* title, - BMessage*, bool drawText = true, bool purge = false); - IconMenuItem(BBitmap*, BMenu*, - bool drawText = true, bool purge = false); - IconMenuItem(const char* mime, const char* title, BMessage*, - bool drawText = true); -virtual ~IconMenuItem(); -virtual void DrawContent(); -virtual void Highlight(bool isHighlighted); -virtual void GetContentSize(float* width, float* height); -static int MinHeight(); + IconMenuItem(BBitmap*, BMenu*, bool drawText = true, + bool purge = false); -private: - void DefaultIcon(const char* mime); - void DrawIcon(); + IconMenuItem(const char* mime, const char* title, BMessage*, + bool drawText = true); - BBitmap* fIcon; - bool fDrawText; - bool fPurge; + virtual ~IconMenuItem(); + virtual void DrawContent(); + virtual void Highlight(bool isHighlighted); + virtual void GetContentSize(float* width, float* height); + + static int MinHeight(); + + private: + void DefaultIcon(const char* mime); + void DrawIcon(); + + BBitmap* fIcon; + bool fDrawText; + bool fPurge; }; bool before_dano(); Modified: haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.h =================================================================== --- haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.h 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.h 2008-01-13 21:07:14 UTC (rev 23498) @@ -25,19 +25,20 @@ class KernelMemoryBarMenuItem : public BMenuItem { public: - KernelMemoryBarMenuItem(system_info& systemInfo); + KernelMemoryBarMenuItem(system_info& systemInfo); virtual void DrawContent(); virtual void GetContentSize(float* _width, float* _height); + void DrawBar(bool force); void UpdateSituation(float commitedMemory, float totalWriteMemory); private: - float fTotalWriteMemory; - float fPhsysicalMemory; - float fCommitedMemory; - double fLastSum; - float fGrenze1; - float fGrenze2; + float fTotalWriteMemory; + float fPhsysicalMemory; + float fCommitedMemory; + double fLastSum; + float fGrenze1; + float fGrenze2; }; #endif // _KERNEL_MEMORY_BAR_MENU_ITEM_H_ Modified: haiku/trunk/src/apps/processcontroller/MemoryBarMenu.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/MemoryBarMenu.cpp 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/MemoryBarMenu.cpp 2008-01-13 21:07:14 UTC (rev 23498) @@ -35,8 +35,7 @@ float gMemoryTextWidth; -MemoryBarMenu::MemoryBarMenu(const char* name, info_pack* infos, - system_info& systemInfo) +MemoryBarMenu::MemoryBarMenu(const char* name, info_pack* infos, system_info& systemInfo) : BMenu(name), fFirstShow(true) { @@ -94,7 +93,7 @@ int lastRecycle = 0; int firstRecycle = 0; int k; - MemoryBarMenuItem *item; + MemoryBarMenuItem* item; int total = 0; for (k = 1; (item = (MemoryBarMenuItem*)ItemAt(k)) != NULL; k++) { int m = item->UpdateSituation(commitedMemory); Modified: haiku/trunk/src/apps/processcontroller/MemoryBarMenu.h =================================================================== --- haiku/trunk/src/apps/processcontroller/MemoryBarMenu.h 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/MemoryBarMenu.h 2008-01-13 21:07:14 UTC (rev 23498) @@ -16,8 +16,8 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _MEMORY_BAR_MENU_H_ -#define _MEMORY_BAR_MENU_H_ +#ifndef MEMORY_BAR_MENU_H +#define MEMORY_BAR_MENU_H #include "Utilities.h" @@ -27,16 +27,17 @@ class MemoryBarMenuItem; + typedef struct { MemoryBarMenuItem* item; int index; } MRecycleItem; + class MemoryBarMenu : public BMenu { public: - MemoryBarMenu(const char* name, info_pack* infos, - system_info& systemInfo); - virtual ~MemoryBarMenu(); + MemoryBarMenu(const char* name, info_pack* infos, system_info& systemInfo); + virtual ~MemoryBarMenu(); virtual void Draw(BRect updateRect); virtual void Pulse(); @@ -52,4 +53,4 @@ extern float gMemoryTextWidth; -#endif // _MEMORY_BAR_MENU_H_ +#endif // MEMORY_BAR_MENU_H Modified: haiku/trunk/src/apps/processcontroller/MemoryBarMenuItem.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/MemoryBarMenuItem.cpp 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/MemoryBarMenuItem.cpp 2008-01-13 21:07:14 UTC (rev 23498) @@ -244,20 +244,20 @@ void MemoryBarMenuItem::BarUpdate() { - area_info ainfo; + area_info areaInfo; int32 cookie = 0; size_t lram_size = 0; size_t lwram_size = 0; bool exists = false; - while (get_next_area_info(fTeamID, &cookie, &ainfo) == B_OK) { + while (get_next_area_info(fTeamID, &cookie, &areaInfo) == B_OK) { exists = true; - lram_size += ainfo.ram_size; + lram_size += areaInfo.ram_size; // TODO: this won't work this way anymore under Haiku! -// int zone = (int (ainfo.address) & 0xf0000000) >> 24; - if ((ainfo.protection & B_WRITE_AREA) != 0) - lwram_size += ainfo.ram_size; +// int zone = (int (areaInfo.address) & 0xf0000000) >> 24; + if ((areaInfo.protection & B_WRITE_AREA) != 0) + lwram_size += areaInfo.ram_size; // && (zone & 0xf0) != 0xA0 // Exclude media buffers // && (fTeamID != gAppServerTeamID || zone != 0x90)) // Exclude app_server side of bitmaps } @@ -287,4 +287,3 @@ fIcon = icon; Init(); } - Modified: haiku/trunk/src/apps/processcontroller/NoiseBarMenuItem.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/NoiseBarMenuItem.cpp 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/NoiseBarMenuItem.cpp 2008-01-13 21:07:14 UTC (rev 23498) @@ -46,17 +46,19 @@ void NoiseBarMenuItem::DrawBar(bool force) { - bool selected = IsSelected (); + bool selected = IsSelected(); BRect frame = Frame(); - BMenu* menu = Menu (); + BMenu* menu = Menu(); frame.right -= 24; - frame.left = frame.right-kBarWidth; + frame.left = frame.right - kBarWidth; frame.top += 5; - frame.bottom = frame.top+8; + frame.bottom = frame.top + 8; if (fBusyWaiting < 0) return; + if (fGrenze1 < 0) force = true; + if (force) { if (selected) menu->SetHighColor(gFrameColorSelected); @@ -64,6 +66,7 @@ menu->SetHighColor(gFrameColor); menu->StrokeRect(frame); } + frame.InsetBy(1, 1); BRect r = frame; float grenze1 = frame.left+(frame.right-frame.left)*fBusyWaiting; @@ -119,5 +122,5 @@ BMenuItem::GetContentSize(width, height); if (*height < 16) *height = 16; - *width += 20+kBarWidth; + *width += 20 + kBarWidth; } Modified: haiku/trunk/src/apps/processcontroller/NoiseBarMenuItem.h =================================================================== --- haiku/trunk/src/apps/processcontroller/NoiseBarMenuItem.h 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/NoiseBarMenuItem.h 2008-01-13 21:07:14 UTC (rev 23498) @@ -27,21 +27,36 @@ #include -//--------------------------------------------------------------- class NoiseBarMenuItem : public BMenuItem { + public: + NoiseBarMenuItem(); -public: - NoiseBarMenuItem(); -virtual void DrawContent(); -virtual void GetContentSize(float* width, float* height); - void DrawBar(bool force); - double fBusyWaiting; - double fLost; + virtual void DrawContent(); + virtual void GetContentSize(float* width, float* height); -private: - float fGrenze1; - float fGrenze2; + void DrawBar(bool force); + + double BusyWaiting() const + { + return fBusyWaiting; + } + + void SetBusyWaiting(double busyWaiting) + { + fBusyWaiting = busyWaiting; + } + + void SetLost(double lost) + { + fLost = lost; + } + + private: + double fBusyWaiting; + double fLost; + float fGrenze1; + float fGrenze2; }; #endif // _NOISE_BAR_MENU_ITEM_H_ Modified: haiku/trunk/src/apps/processcontroller/PCWindow.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/PCWindow.cpp 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/PCWindow.cpp 2008-01-13 21:07:14 UTC (rev 23498) @@ -36,7 +36,7 @@ : BWindow(BRect(100, 150, 131, 181), "ProcessController", B_TITLED_WINDOW, B_NOT_H_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) { - GebsPreferences preferences(kPreferencesFileName); + Preferences preferences(kPreferencesFileName); preferences.SaveInt32(kCurrentVersion, kVersionName); preferences.LoadWindowPosition(this, kPosPrefName); @@ -70,11 +70,10 @@ bool PCWindow::QuitRequested() { - GebsPreferences tPreferences(kPreferencesFileName); + Preferences tPreferences(kPreferencesFileName); tPreferences.SaveInt32(kCurrentVersion, kVersionName); tPreferences.SaveWindowPosition(this, kPosPrefName); be_app->PostMessage(B_QUIT_REQUESTED); return true; } - Modified: haiku/trunk/src/apps/processcontroller/PCWorld.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/PCWorld.cpp 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/PCWorld.cpp 2008-01-13 21:07:14 UTC (rev 23498) @@ -76,7 +76,7 @@ void PCApplication::ReadyToRun() { - GebsPreferences preferences(kPreferencesFileName); + Preferences preferences(kPreferencesFileName); int32 version = 0; preferences.ReadInt32(version, kVersionName); if (version != kCurrentVersion) { Modified: haiku/trunk/src/apps/processcontroller/Preferences.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/Preferences.cpp 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/Preferences.cpp 2008-01-13 21:07:14 UTC (rev 23498) @@ -21,6 +21,10 @@ #include "Preferences.h" #include "Utilities.h" +#include +#include +#include + #include #include #include @@ -29,12 +33,8 @@ #include #include -#include -#include -#include - -GebsPreferences::GebsPreferences(const char* name, const char* signature, bool doSave) +Preferences::Preferences(const char* name, const char* signature, bool doSave) : BMessage('Pref'), BLocker("Preferences", true), fSavePreferences(doSave) { @@ -61,7 +61,7 @@ } -GebsPreferences::GebsPreferences(const entry_ref &ref, const char* signature, bool doSave) +Preferences::Preferences(const entry_ref &ref, const char* signature, bool doSave) : BMessage('Pref'), BLocker("Preferences", true), fSavePreferences(doSave) { @@ -82,7 +82,7 @@ } -GebsPreferences::~GebsPreferences() +Preferences::~Preferences() { if (fSavePreferences) { BFile file; @@ -101,7 +101,7 @@ Flatten(&file); if (fSignature) { file.WriteAttr("BEOS:TYPE", B_MIME_STRING_TYPE, 0, fSignature, - strlen(fSignature)+1); + strlen(fSignature) + 1); } } else { // implement saving somewhere else! @@ -119,7 +119,7 @@ status_t -GebsPreferences::MakeEmpty() +Preferences::MakeEmpty() { Lock(); status_t status = BMessage::MakeEmpty(); @@ -129,7 +129,7 @@ void -GebsPreferences::SaveWindowPosition(BWindow* window, const char* name) +Preferences::SaveWindowPosition(BWindow* window, const char* name) { Lock(); @@ -144,7 +144,7 @@ void -GebsPreferences::LoadWindowPosition(BWindow* window, const char* name) +Preferences::LoadWindowPosition(BWindow* window, const char* name) { Lock(); @@ -159,7 +159,7 @@ void -GebsPreferences::SaveWindowFrame(BWindow* window, const char* name) +Preferences::SaveWindowFrame(BWindow* window, const char* name) { Lock(); @@ -174,7 +174,7 @@ void -GebsPreferences::LoadWindowFrame(BWindow* window, const char* name) +Preferences::LoadWindowFrame(BWindow* window, const char* name) { Lock(); @@ -190,7 +190,7 @@ void -GebsPreferences::SaveInt32(int32 value, const char* name) +Preferences::SaveInt32(int32 value, const char* name) { Lock(); @@ -204,7 +204,7 @@ bool -GebsPreferences::ReadInt32(int32 &val, const char* name) +Preferences::ReadInt32(int32 &val, const char* name) { Lock(); int32 readVal; @@ -217,7 +217,7 @@ void -GebsPreferences::SaveFloat(float val, const char* name) +Preferences::SaveFloat(float val, const char* name) { Lock(); if (HasFloat(name)) @@ -229,11 +229,11 @@ bool -GebsPreferences::ReadFloat(float &val, const char* name) +Preferences::ReadFloat(float &val, const char* name) { Lock(); float readVal; - bool found = FindFloat(name, &readVal)==B_OK; + bool found = FindFloat(name, &readVal) == B_OK; if (found) val = readVal; Unlock(); @@ -242,7 +242,7 @@ void -GebsPreferences::SaveRect(BRect &rect, const char* name) +Preferences::SaveRect(BRect& rect, const char* name) { Lock(); if (HasRect(name)) @@ -254,11 +254,11 @@ BRect & -GebsPreferences::ReadRect(BRect &rect, const char* name) +Preferences::ReadRect(BRect& rect, const char* name) { Lock(); BRect loaded; - if (FindRect(name, &loaded)==B_OK) + if (FindRect(name, &loaded) == B_OK) rect = loaded; Unlock(); return rect; @@ -266,7 +266,7 @@ void -GebsPreferences::SaveString(BString &string, const char* name) +Preferences::SaveString(BString &string, const char* name) { Lock(); if (HasString(name)) @@ -278,7 +278,7 @@ void -GebsPreferences::SaveString(const char* string, const char* name) +Preferences::SaveString(const char* string, const char* name) { Lock(); if (HasString(name)) @@ -290,7 +290,7 @@ bool -GebsPreferences::ReadString(BString &string, const char* name) +Preferences::ReadString(BString &string, const char* name) { Lock(); bool loaded = FindString(name, &string) == B_OK; Modified: haiku/trunk/src/apps/processcontroller/Preferences.h =================================================================== --- haiku/trunk/src/apps/processcontroller/Preferences.h 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/Preferences.h 2008-01-13 21:07:14 UTC (rev 23498) @@ -21,42 +21,43 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef PREFERENCES_H +#define PREFERENCES_H -#ifndef _Preferences_H_ -#define _Preferences_H_ - +#include +#include #include -#include -#include -class GebsPreferences : public BMessage, public BLocker { -public: - GebsPreferences (const char* thename, const char* thesignature=NULL, bool doSave=true); - GebsPreferences (const entry_ref &ref, const char* thesignature=NULL, bool doSave=true); - ~GebsPreferences (); - status_t MakeEmpty (); - void SaveWindowPosition (BWindow* window, const char* name); - void LoadWindowPosition (BWindow* window, const char* name); - void SaveWindowFrame (BWindow* window, const char* name); - void LoadWindowFrame (BWindow* window, const char* name); - void SaveInt32 (int32 val, const char* name); - bool ReadInt32 (int32 &val, const char* name); - void SaveFloat (float val, const char* name); - bool ReadFloat (float &val, const char* name); - void SaveRect (BRect &rect, const char* name); - BRect& ReadRect (BRect &rect, const char* name); - void SaveString (BString &string, const char* name); - void SaveString (const char* string, const char* name); - bool ReadString (BString &string, const char* name); - bool fNewPreferences; - bool fSavePreferences; - char *fName; - char *fSignature; - entry_ref *fSettingsFile; +class Preferences : public BMessage, public BLocker { + public: + Preferences(const char* thename, const char* thesignature = NULL, bool doSave = true); + Preferences(const entry_ref& ref, const char* thesignature = NULL, bool doSave = true); + ~Preferences(); + status_t MakeEmpty(); + void SaveWindowPosition(BWindow* window, const char* name); + void LoadWindowPosition(BWindow* window, const char* name); + void SaveWindowFrame(BWindow* window, const char* name); + void LoadWindowFrame(BWindow* window, const char* name); + void SaveInt32(int32 val, const char* name); + bool ReadInt32(int32& val, const char* name); + void SaveFloat(float val, const char* name); + bool ReadFloat(float& val, const char* name); + void SaveRect(BRect& rect, const char* name); + BRect& ReadRect(BRect& rect, const char* name); + void SaveString(BString& string, const char* name); + void SaveString(const char* string, const char* name); + bool ReadString(BString& string, const char* name); + + private: + bool fNewPreferences; + bool fSavePreferences; + char* fName; + char* fSignature; + entry_ref* fSettingsFile; }; -extern GebsPreferences gPreferences; +extern Preferences gPreferences; // ggPreferences.LoadWindowPosition(this, kPosPrefName); // ggPreferences.SaveWindowPosition(this, kPosPrefName); @@ -64,4 +65,4 @@ // ggPreferences.LoadWindowFrame(this, frame); // ggPreferences.SaveWindowFrame(this, frame); -#endif // _Preferences_H_ +#endif // PREFERENCES_H Modified: haiku/trunk/src/apps/processcontroller/ProcessController.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/ProcessController.cpp 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/ProcessController.cpp 2008-01-13 21:07:14 UTC (rev 23498) @@ -417,7 +417,7 @@ else SetViewColor(kBlack); - GebsPreferences tPreferences(kPreferencesFileName, NULL, false); + Preferences tPreferences(kPreferencesFileName, NULL, false); DefaultColors(); system_info info; Modified: haiku/trunk/src/apps/processcontroller/QuitMenu.h =================================================================== --- haiku/trunk/src/apps/processcontroller/QuitMenu.h 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/QuitMenu.h 2008-01-13 21:07:14 UTC (rev 23498) @@ -28,7 +28,7 @@ class QuitMenu : public BMenu { public: - QuitMenu(const char* title, info_pack* infos, int infosCount); + QuitMenu(const char* title, info_pack* infos, int infosCount); virtual void AttachedToWindow(); virtual void DetachedFromWindow(); virtual void MessageReceived(BMessage *msg); Modified: haiku/trunk/src/apps/processcontroller/TeamBarMenu.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/TeamBarMenu.cpp 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/TeamBarMenu.cpp 2008-01-13 21:07:14 UTC (rev 23498) @@ -103,7 +103,7 @@ k -= lastRecycle; lastRecycle = 0; } - total += item->fUser+item->fKernel; + total += item->fUser + item->fKernel; } } @@ -126,7 +126,7 @@ j++; if (j == fTeamCount) { fTeamCount += 10; - fTeamList = (team_id*)realloc(fTeamList, sizeof(team_id)*fTeamCount); + fTeamList = (team_id*)realloc(fTeamList, sizeof(team_id) * fTeamCount); } fTeamList[j] = infos.team_info.team; if (!get_team_name_and_icon(infos, true)) { @@ -165,16 +165,19 @@ // Delete the items that haven't been recycled. if (firstRecycle < lastRecycle) - RemoveItems(IndexOf(fRecycleList[firstRecycle].item), lastRecycle-firstRecycle, true); + RemoveItems(IndexOf(fRecycleList[firstRecycle].item), lastRecycle - firstRecycle, true); total /= gCPUcount; - total = 1-total; + total = 1 - total; fLastTotalTime = system_time(); NoiseBarMenuItem* noiseItem; if ((noiseItem = (NoiseBarMenuItem*)ItemAt(0)) != NULL) { - noiseItem->fBusyWaiting = 0; - noiseItem->fLost = (total >= 0 ? total : 0); + noiseItem->SetBusyWaiting(0); + if (total >= 0) + noiseItem->SetLost(total); + else + noiseItem->SetLost(0); noiseItem->DrawBar(false); } Modified: haiku/trunk/src/apps/processcontroller/TeamBarMenuItem.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/TeamBarMenuItem.cpp 2008-01-13 20:46:32 UTC (rev 23497) +++ haiku/trunk/src/apps/processcontroller/TeamBarMenuItem.cpp 2008-01-13 21:07:14 UTC (rev 23498) @@ -17,6 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "TeamBarMenuItem.h" #include "Colors.h" @@ -30,8 +31,8 @@ #define B_USAGE_SELF 0 -TeamBarMenuItem::TeamBarMenuItem(BMenu *menu, BMessage *kill_team, team_id team, - BBitmap* icon, bool deleteIcon) +TeamBarMenuItem::TeamBarMenuItem(BMenu* menu, BMessage* kill_team, team_id team, + BBitmap* icon, bool deleteIcon) : BMenuItem(menu, kill_team), fTeamID(team), fIcon(icon), @@ -44,8 +45,8 @@ void TeamBarMenuItem::Init() { - team_info tminfo; - get_team_info(fTeamID, &tminfo); + team_info teamInfo; + get_team_info(fTeamID, &teamInfo); get_team_usage_info(fTeamID, B_USAGE_SELF, &fTeamUsageInfo); if (fTeamID == B_SYSTEM_TEAM) { thread_info thinfos; @@ -139,8 +140,8 @@ frame.InsetBy(1, 1); BRect r = frame; - float grenze1 = frame.left+(frame.right-frame.left)*fKernel/gCPUcount; - float grenze2 = frame.left+(frame.right-frame.left)*(fKernel+fUser)/gCPUcount; + float grenze1 = frame.left + (frame.right - frame.left) * fKernel / gCPUcount; + float grenze2 = frame.left + (frame.right - frame.left) * (fKernel + fUser) / gCPUcount; if (grenze1 > frame.right) grenze1 = frame.right; if (grenze2 > frame.right) @@ -199,7 +200,7 @@ BMenuItem::GetContentSize(width, height); if (*height < 16) *height = 16; - *width += 40+kBarWidth; + *width += 40 + kBarWidth; } @@ -219,8 +220,12 @@ usage.user_time = idle; idle -= fTeamUsageInfo.user_time; } - fKernel = double(usage.kernel_time-fTeamUsageInfo.kernel_time-idle)/double(now-fLastTime); - fUser = double(usage.user_time-fTeamUsageInfo.user_time)/double(now-fLastTime); + + fKernel = double(usage.kernel_time - fTeamUsageInfo.kernel_time - idle) + / double(now - fLastTime); + + fUser = double(usage.user_time - fTeamUsageInfo.user_time) / double(now - fLastTime); + if (fKernel < 0) [... truncated: 138 lines follow ...] From bonefish at mail.berlios.de Sun Jan 13 22:15:39 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 13 Jan 2008 22:15:39 +0100 Subject: [Haiku-commits] r23499 - haiku/trunk/data/system/boot Message-ID: <200801132115.m0DLFdpg017628@sheep.berlios.de> Author: bonefish Date: 2008-01-13 22:15:38 +0100 (Sun, 13 Jan 2008) New Revision: 23499 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23499&view=rev Modified: haiku/trunk/data/system/boot/Bootscript Log: Always install ProcessController in the deskbar. Modified: haiku/trunk/data/system/boot/Bootscript =================================================================== --- haiku/trunk/data/system/boot/Bootscript 2008-01-13 21:07:14 UTC (rev 23498) +++ haiku/trunk/data/system/boot/Bootscript 2008-01-13 21:15:38 UTC (rev 23499) @@ -93,6 +93,9 @@ else launch beos/system/Tracker launch beos/system/Deskbar + + # install ProcessController in the deskbar + (sleep 7; /boot/beos/apps/ProcessController -deskbar) & fi launch beos/apps/Terminal else From korli at mail.berlios.de Sun Jan 13 22:59:24 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 13 Jan 2008 22:59:24 +0100 Subject: [Haiku-commits] r23500 - haiku/trunk/src/apps/deskbar Message-ID: <200801132159.m0DLxO2t021943@sheep.berlios.de> Author: korli Date: 2008-01-13 22:59:23 +0100 (Sun, 13 Jan 2008) New Revision: 23500 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23500&view=rev Modified: haiku/trunk/src/apps/deskbar/StatusView.cpp haiku/trunk/src/apps/deskbar/Switcher.cpp haiku/trunk/src/apps/deskbar/WindowMenuItem.h Log: whitespaces => tab Modified: haiku/trunk/src/apps/deskbar/StatusView.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/StatusView.cpp 2008-01-13 21:15:38 UTC (rev 23499) +++ haiku/trunk/src/apps/deskbar/StatusView.cpp 2008-01-13 21:59:23 UTC (rev 23500) @@ -451,7 +451,7 @@ bool haveKey = false; BPath path; - if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) { + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) { path.Append(kDeskbarSecurityCodeFile); BFile file(path.Path(),B_READ_ONLY); @@ -470,7 +470,7 @@ fDeskbarSecurityCode = ((real & 0xffffffffULL) << 32) | (boot & 0xffffffffULL); - if (find_directory (B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) { + 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) Modified: haiku/trunk/src/apps/deskbar/Switcher.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/Switcher.cpp 2008-01-13 21:15:38 UTC (rev 23499) +++ haiku/trunk/src/apps/deskbar/Switcher.cpp 2008-01-13 21:59:23 UTC (rev 23500) @@ -251,7 +251,7 @@ front visible window (the first on the list), going down through all the other visible windows, then all the hidden or non workspace visible window at the end. - + layer > 2 : normal visible window. layer == 2 : reserved for the desktop window (visible also). layer < 2 : hidden (0) and non workspace visible window (1) Modified: haiku/trunk/src/apps/deskbar/WindowMenuItem.h =================================================================== --- haiku/trunk/src/apps/deskbar/WindowMenuItem.h 2008-01-13 21:15:38 UTC (rev 23499) +++ haiku/trunk/src/apps/deskbar/WindowMenuItem.h 2008-01-13 21:59:23 UTC (rev 23500) @@ -107,7 +107,7 @@ // from interface_defs.h struct window_info { team_id team; - int32 id; /* window's token */ + int32 id; /* window's token */ int32 thread; int32 client_token; @@ -115,8 +115,8 @@ uint32 workspaces; int32 layer; - uint32 w_type; /* B_TITLED_WINDOW, etc. */ - uint32 flags; /* B_WILL_FLOAT, etc. */ + uint32 w_type; /* B_TITLED_WINDOW, etc. */ + uint32 flags; /* B_WILL_FLOAT, etc. */ int32 window_left; int32 window_top; int32 window_right; From korli at mail.berlios.de Sun Jan 13 23:03:35 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 13 Jan 2008 23:03:35 +0100 Subject: [Haiku-commits] r23501 - haiku/trunk/src/apps/packageinstaller Message-ID: <200801132203.m0DM3ZQB022310@sheep.berlios.de> Author: korli Date: 2008-01-13 23:03:34 +0100 (Sun, 13 Jan 2008) New Revision: 23501 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23501&view=rev Modified: haiku/trunk/src/apps/packageinstaller/InstalledPackageInfo.cpp haiku/trunk/src/apps/packageinstaller/PackageView.cpp Log: style cleanup Modified: haiku/trunk/src/apps/packageinstaller/InstalledPackageInfo.cpp =================================================================== --- haiku/trunk/src/apps/packageinstaller/InstalledPackageInfo.cpp 2008-01-13 21:59:23 UTC (rev 23500) +++ haiku/trunk/src/apps/packageinstaller/InstalledPackageInfo.cpp 2008-01-13 22:03:34 UTC (rev 23501) @@ -37,7 +37,7 @@ return B_ERROR; status_t ret = info->Unflatten(file); - if (ret != B_OK || info->what != P_PACKAGE_INFO) + if (ret != B_OK || info->what != P_PACKAGE_INFO) return B_ERROR; return B_OK; Modified: haiku/trunk/src/apps/packageinstaller/PackageView.cpp =================================================================== --- haiku/trunk/src/apps/packageinstaller/PackageView.cpp 2008-01-13 21:59:23 UTC (rev 23500) +++ haiku/trunk/src/apps/packageinstaller/PackageView.cpp 2008-01-13 22:03:34 UTC (rev 23501) @@ -114,13 +114,13 @@ fOpenPanel->SetTarget(BMessenger(this)); fInstallTypes->SetTargetForItems(this); - if (fInfo.InitCheck() == B_OK) { - // If the package is valid, we can set up the default group and all - // other things. If not, then the application will close just after - // attaching the view to the window - _GroupChanged(0); + if (fInfo.InitCheck() == B_OK) { + // If the package is valid, we can set up the default group and all + // other things. If not, then the application will close just after + // attaching the view to the window + _GroupChanged(0); - fStatusWindow = new PackageStatus(T("Installation progress")); + fStatusWindow = new PackageStatus(T("Installation progress")); // Show the splash screen, if present BMallocIO *image = fInfo.GetSplashScreen(); @@ -130,18 +130,18 @@ } // Show the disclaimer/info text popup, if present - BString disclaimer = fInfo.GetDisclaimer(); - if (disclaimer.Length() != 0) { - PackageTextViewer *text = new PackageTextViewer(disclaimer.String()); - int32 selection = text->Go(); - // The user didn't accept our disclaimer, this means we cannot continue. - if (selection == 0) { + BString disclaimer = fInfo.GetDisclaimer(); + if (disclaimer.Length() != 0) { + PackageTextViewer *text = new PackageTextViewer(disclaimer.String()); + int32 selection = text->Go(); + // The user didn't accept our disclaimer, this means we cannot continue. + if (selection == 0) { BWindow *parent = Window(); if (parent && parent->Lock()) parent->Quit(); - } - } - } + } + } + } } From korli at mail.berlios.de Sun Jan 13 23:17:16 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 13 Jan 2008 23:17:16 +0100 Subject: [Haiku-commits] r23502 - haiku/trunk/src/preferences/sounds Message-ID: <200801132217.m0DMHGOL023021@sheep.berlios.de> Author: korli Date: 2008-01-13 23:17:15 +0100 (Sun, 13 Jan 2008) New Revision: 23502 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23502&view=rev Modified: haiku/trunk/src/preferences/sounds/HApp.cpp haiku/trunk/src/preferences/sounds/HEventItem.cpp haiku/trunk/src/preferences/sounds/HEventList.cpp haiku/trunk/src/preferences/sounds/HWindow.cpp haiku/trunk/src/preferences/sounds/Sounds.rdef Log: style cleanup Modified: haiku/trunk/src/preferences/sounds/HApp.cpp =================================================================== --- haiku/trunk/src/preferences/sounds/HApp.cpp 2008-01-13 22:03:34 UTC (rev 23501) +++ haiku/trunk/src/preferences/sounds/HApp.cpp 2008-01-13 22:17:15 UTC (rev 23502) @@ -39,7 +39,7 @@ " Oliver Ruiz Dorantes\n" " J?r?me DUVAL.\n" " Original work from Atsushi Takamatsu.\n" - "Copyright " B_UTF8_COPYRIGHT "2003-2006 Haiku","OK"))->Go(); + "Copyright " B_UTF8_COPYRIGHT "2003-2006 Haiku", "OK"))->Go(); } Modified: haiku/trunk/src/preferences/sounds/HEventItem.cpp =================================================================== --- haiku/trunk/src/preferences/sounds/HEventItem.cpp 2008-01-13 22:03:34 UTC (rev 23501) +++ haiku/trunk/src/preferences/sounds/HEventItem.cpp 2008-01-13 22:17:15 UTC (rev 23502) @@ -61,11 +61,11 @@ /*********************************************************** * DrawItem ***********************************************************/ -void +void HEventItem::DrawItem(BView *owner, BRect itemRect, bool complete) { rgb_color kBlack = { 0,0,0,0 }; - + if (IsSelected() || complete) { rgb_color color; if (IsSelected()) @@ -77,7 +77,6 @@ owner->SetLowColor(color); owner->FillRect(itemRect); owner->SetHighColor(kBlack); - } else { owner->SetLowColor(owner->ViewColor()); Modified: haiku/trunk/src/preferences/sounds/HEventList.cpp =================================================================== --- haiku/trunk/src/preferences/sounds/HEventList.cpp 2008-01-13 22:03:34 UTC (rev 23501) +++ haiku/trunk/src/preferences/sounds/HEventList.cpp 2008-01-13 22:17:15 UTC (rev 23502) @@ -97,8 +97,8 @@ HEventItem *item = cast_as(ItemAt(sel),HEventItem); if(!item) return; - - entry_ref ref; + + entry_ref ref; BMediaFiles().GetRefFor(fType, item->Name(), &ref); BPath path(&ref); @@ -117,7 +117,7 @@ msg.AddString("path",item->Path()); Window()->PostMessage(&msg); } -} +} /*********************************************************** * SetPath @@ -137,6 +137,6 @@ BMediaFiles().SetRefFor(fType, item->Name(), ref); item->SetPath(path); - InvalidateItem(sel); + InvalidateItem(sel); } } Modified: haiku/trunk/src/preferences/sounds/HWindow.cpp =================================================================== --- haiku/trunk/src/preferences/sounds/HWindow.cpp 2008-01-13 22:03:34 UTC (rev 23501) +++ haiku/trunk/src/preferences/sounds/HWindow.cpp 2008-01-13 22:17:15 UTC (rev 23502) @@ -39,18 +39,18 @@ /*********************************************************** * Constructor ***********************************************************/ -HWindow::HWindow(BRect rect ,const char* name) - :_inherited(rect,name,B_TITLED_WINDOW,0) - ,fFilePanel(NULL) - ,fPlayer(NULL) +HWindow::HWindow(BRect rect, const char* name) + :_inherited(rect, name, B_TITLED_WINDOW, 0), + fFilePanel(NULL), + fPlayer(NULL) { InitGUI(); - float min_width,min_height,max_width,max_height; - GetSizeLimits(&min_width,&max_width,&min_height,&max_height); + float min_width, min_height, max_width, max_height; + GetSizeLimits(&min_width, &max_width, &min_height, &max_height); min_width = 300; min_height = 200; - SetSizeLimits(min_width,max_width,min_height,max_height); - + SetSizeLimits(min_width, max_width, min_height, max_height); + fFilePanel = new BFilePanel(); fFilePanel->SetTarget(this); @@ -74,7 +74,7 @@ { BRect rect = Bounds(); rect.bottom -= 106; - BView *listView = new BView(rect,"",B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED); + BView *listView = new BView(rect, "", B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED); listView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(listView); @@ -89,7 +89,7 @@ stringView->SetFont(be_bold_font); stringView->ResizeToPreferred(); listView->AddChild(stringView); - + rect.left += 13; rect.right -= B_V_SCROLL_BAR_WIDTH + 13; rect.top += 28; @@ -107,11 +107,11 @@ rect = Bounds(); rect.top = rect.bottom - 105; - BView *view = new BView(rect,"", B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED); + BView *view = new BView(rect, "", B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED); view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(view); rect = view->Bounds().InsetBySelf(12, 12); - BBox *box = new BBox(rect,"",B_FOLLOW_ALL); + BBox *box = new BBox(rect, "", B_FOLLOW_ALL); view->AddChild(box); rect = box->Bounds(); rect.top += 10; @@ -123,8 +123,8 @@ menu->SetLabelFromMarked(true); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("",new BMessage(M_NONE_MESSAGE))); - menu->AddItem(new BMenuItem("Other?",new BMessage(M_OTHER_MESSAGE))); + menu->AddItem(new BMenuItem("", new BMessage(M_NONE_MESSAGE))); + menu->AddItem(new BMenuItem("Other?", new BMessage(M_OTHER_MESSAGE))); BMenuField *menuField = new BMenuField(rect ,"filemenu" ,"Sound File:" @@ -178,18 +178,18 @@ switch(message->what) { case M_OTHER_MESSAGE: { - BMenuField *menufield = cast_as(FindView("filemenu"),BMenuField); + BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField); BMenu *menu = menufield->Menu(); int32 sel = fEventList->CurrentSelection(); if(sel >= 0) { - HEventItem *item = cast_as(fEventList->ItemAt(sel),HEventItem); + HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem); BPath path(item->Path()); if(path.InitCheck() != B_OK) { BMenuItem *item = menu->FindItem(""); if(item) item->SetMarked(true); - } else{ + } else{ BMenuItem *item = menu->FindItem(path.Leaf()); if(item) item->SetMarked(true); @@ -203,8 +203,8 @@ { entry_ref ref; int32 sel = fEventList->CurrentSelection(); - if(message->FindRef("refs",&ref) == B_OK && sel >= 0) { - BMenuField *menufield = cast_as(FindView("filemenu"),BMenuField); + if(message->FindRef("refs", &ref) == B_OK && sel >= 0) { + BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField); BMenu *menu = menufield->Menu(); // check audio file BNode node(&ref); @@ -216,20 +216,20 @@ mtype.GetSupertype(&superType); if (superType.Type() == NULL || strcmp(superType.Type(), "audio") != 0) { beep(); - (new BAlert("","This is not a audio file.","OK",NULL,NULL, - B_WIDTH_AS_USUAL,B_STOP_ALERT))->Go(); + (new BAlert("", "This is not a audio file.", "OK", NULL, NULL, + B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); break; } // add file item BMessage *msg = new BMessage(M_ITEM_MESSAGE); BPath path(&ref); - msg->AddRef("refs",&ref); + msg->AddRef("refs", &ref); BMenuItem *menuitem = menu->FindItem(path.Leaf()); if(!menuitem) - menu->AddItem(menuitem = new BMenuItem(path.Leaf(),msg),0); + menu->AddItem(menuitem = new BMenuItem(path.Leaf(), msg), 0); // refresh item fEventList->SetPath(BPath(&ref).Path()); - // check file menu + // check file menu if(menuitem) menuitem->SetMarked(true); } @@ -240,14 +240,14 @@ int32 sel = fEventList->CurrentSelection(); if(sel >= 0) { - HEventItem *item = cast_as(fEventList->ItemAt(sel),HEventItem); + HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem); const char* path = item->Path(); if(path) { entry_ref ref; - ::get_ref_for_path(path,&ref); + ::get_ref_for_path(path, &ref); delete fPlayer; - fPlayer = new BFileGameSound(&ref,false); + fPlayer = new BFileGameSound(&ref, false); fPlayer->StartPlaying(); } } @@ -268,16 +268,16 @@ case M_EVENT_CHANGED: { const char* path; - BMenuField *menufield = cast_as(FindView("filemenu"),BMenuField); + BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField); BMenu *menu = menufield->Menu(); - if(message->FindString("path",&path) == B_OK) { + if(message->FindString("path", &path) == B_OK) { BPath path(path); if(path.InitCheck() != B_OK) { BMenuItem *item = menu->FindItem(""); if(item) item->SetMarked(true); - } else { + } else { BMenuItem *item = menu->FindItem(path.Leaf()); if(item) item->SetMarked(true); @@ -288,7 +288,7 @@ case M_ITEM_MESSAGE: { entry_ref ref; - if(message->FindRef("refs",&ref) == B_OK) { + if(message->FindRef("refs", &ref) == B_OK) { fEventList->SetPath(BPath(&ref).Path()); } break; @@ -309,14 +309,14 @@ void HWindow::SetupMenuField() { - BMenuField *menufield = cast_as(FindView("filemenu"),BMenuField); + BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField); BMenu *menu = menufield->Menu(); int32 count = fEventList->CountItems(); for(int32 i = 0; i < count; i++) { HEventItem *item = cast_as(fEventList->ItemAt(i), HEventItem); if(!item) continue; - + BPath path(item->Path()); if(path.InitCheck() != B_OK) continue; @@ -325,9 +325,9 @@ BMessage *msg = new BMessage(M_ITEM_MESSAGE); entry_ref ref; - ::get_ref_for_path(path.Path(),&ref); - msg->AddRef("refs",&ref); - menu->AddItem(new BMenuItem(path.Leaf(),msg),0); + ::get_ref_for_path(path.Path(), &ref); + msg->AddRef("refs", &ref); + menu->AddItem(new BMenuItem(path.Leaf(), msg), 0); } BPath path("/boot/beos/etc/sounds"); @@ -335,63 +335,63 @@ BDirectory dir( path.Path() ); BEntry entry; BPath item_path; - while( err == B_OK ){ - err = dir.GetNextEntry( (BEntry*)&entry, TRUE ); - if( entry.InitCheck() != B_NO_ERROR ){ + while (err == B_OK){ + err = dir.GetNextEntry((BEntry *)&entry, true); + if (entry.InitCheck() != B_NO_ERROR) { break; } entry.GetPath(&item_path); - if( menu->FindItem(item_path.Leaf()) ) + if (menu->FindItem(item_path.Leaf())) continue; - + BMessage *msg = new BMessage(M_ITEM_MESSAGE); entry_ref ref; - ::get_ref_for_path(item_path.Path(),&ref); - msg->AddRef("refs",&ref); - menu->AddItem(new BMenuItem(item_path.Leaf(),msg),0); + ::get_ref_for_path(item_path.Path(), &ref); + msg->AddRef("refs", &ref); + menu->AddItem(new BMenuItem(item_path.Leaf(), msg), 0); } path.SetTo("/boot/home/config/sounds"); dir.SetTo(path.Path()); err = B_OK; - while( err == B_OK ){ - err = dir.GetNextEntry( (BEntry*)&entry, TRUE ); - if( entry.InitCheck() != B_NO_ERROR ){ + while (err == B_OK) { + err = dir.GetNextEntry((BEntry *)&entry, true); + if (entry.InitCheck() != B_NO_ERROR) { break; } entry.GetPath(&item_path); - if( menu->FindItem(item_path.Leaf()) ) + if (menu->FindItem(item_path.Leaf())) continue; - + BMessage *msg = new BMessage(M_ITEM_MESSAGE); entry_ref ref; - ::get_ref_for_path(item_path.Path(),&ref); - msg->AddRef("refs",&ref); - menu->AddItem(new BMenuItem(item_path.Leaf(),msg),0); + ::get_ref_for_path(item_path.Path(), &ref); + msg->AddRef("refs", &ref); + menu->AddItem(new BMenuItem(item_path.Leaf(), msg), 0); } path.SetTo("/boot/home/media"); dir.SetTo(path.Path()); err = B_OK; - while( err == B_OK ){ - err = dir.GetNextEntry( (BEntry*)&entry, TRUE ); - if( entry.InitCheck() != B_NO_ERROR ){ + while (err == B_OK) { + err = dir.GetNextEntry((BEntry *)&entry, true); + if (entry.InitCheck() != B_NO_ERROR) { break; } entry.GetPath(&item_path); - if( menu->FindItem(item_path.Leaf()) ) + if (menu->FindItem(item_path.Leaf())) continue; - + BMessage *msg = new BMessage(M_ITEM_MESSAGE); entry_ref ref; - ::get_ref_for_path(item_path.Path(),&ref); - msg->AddRef("refs",&ref); - menu->AddItem(new BMenuItem(item_path.Leaf(),msg),0); + ::get_ref_for_path(item_path.Path(), &ref); + msg->AddRef("refs", &ref); + menu->AddItem(new BMenuItem(item_path.Leaf(), msg), 0); } } @@ -404,9 +404,9 @@ HWindow::Pulse() { int32 sel = fEventList->CurrentSelection(); - BMenuField *menufield = cast_as(FindView("filemenu"),BMenuField); - BButton *button = cast_as(FindView("play"),BButton); - BButton *stop = cast_as(FindView("stop"),BButton); + BMenuField *menufield = cast_as(FindView("filemenu"), BMenuField); + BButton *button = cast_as(FindView("play"), BButton); + BButton *stop = cast_as(FindView("stop"), BButton); if(!menufield) return; @@ -414,7 +414,7 @@ if(sel >=0) { menufield->SetEnabled(true); - HEventItem *item = cast_as(fEventList->ItemAt(sel),HEventItem); + HEventItem *item = cast_as(fEventList->ItemAt(sel), HEventItem); const char* path = item->Path(); if (path && strcmp(path, "")) button->SetEnabled(true); @@ -438,11 +438,11 @@ * DispatchMessage ***********************************************************/ void -HWindow::DispatchMessage(BMessage *message,BHandler *handler) +HWindow::DispatchMessage(BMessage *message, BHandler *handler) { if(message->what == B_PULSE) Pulse(); - BWindow::DispatchMessage(message,handler); + BWindow::DispatchMessage(message, handler); } /*********************************************************** Modified: haiku/trunk/src/preferences/sounds/Sounds.rdef =================================================================== --- haiku/trunk/src/preferences/sounds/Sounds.rdef 2008-01-13 22:03:34 UTC (rev 23501) +++ haiku/trunk/src/preferences/sounds/Sounds.rdef 2008-01-13 22:17:15 UTC (rev 23502) @@ -15,7 +15,7 @@ internal = 0, short_info = "Sounds", - long_info = "Sounds ?2003-2007 Haiku" + long_info = "Sounds ?2003-2007 Haiku" }; resource file_types message; From korli at mail.berlios.de Sun Jan 13 23:17:50 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 13 Jan 2008 23:17:50 +0100 Subject: [Haiku-commits] r23503 - in haiku/trunk/src/preferences: fonts mouse Message-ID: <200801132217.m0DMHoOQ023084@sheep.berlios.de> Author: korli Date: 2008-01-13 23:17:50 +0100 (Sun, 13 Jan 2008) New Revision: 23503 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23503&view=rev Modified: haiku/trunk/src/preferences/fonts/Fonts.rdef haiku/trunk/src/preferences/mouse/Mouse.rdef haiku/trunk/src/preferences/mouse/MouseView.cpp Log: whitespace => tab Modified: haiku/trunk/src/preferences/fonts/Fonts.rdef =================================================================== --- haiku/trunk/src/preferences/fonts/Fonts.rdef 2008-01-13 22:17:15 UTC (rev 23502) +++ haiku/trunk/src/preferences/fonts/Fonts.rdef 2008-01-13 22:17:50 UTC (rev 23503) @@ -13,7 +13,7 @@ internal = 0, short_info = "Fonts", - long_info = "Fonts ?2002-2006 Haiku" + long_info = "Fonts ?2002-2006 Haiku" }; resource app_flags B_SINGLE_LAUNCH; Modified: haiku/trunk/src/preferences/mouse/Mouse.rdef =================================================================== --- haiku/trunk/src/preferences/mouse/Mouse.rdef 2008-01-13 22:17:15 UTC (rev 23502) +++ haiku/trunk/src/preferences/mouse/Mouse.rdef 2008-01-13 22:17:50 UTC (rev 23503) @@ -15,7 +15,7 @@ internal = 0, short_info = "Mouse", - long_info = "Mouse ?2002-2007 Haiku" + long_info = "Mouse ?2002-2007 Haiku" }; #ifdef HAIKU_TARGET_PLATFORM_HAIKU Modified: haiku/trunk/src/preferences/mouse/MouseView.cpp =================================================================== --- haiku/trunk/src/preferences/mouse/MouseView.cpp 2008-01-13 22:17:15 UTC (rev 23502) +++ haiku/trunk/src/preferences/mouse/MouseView.cpp 2008-01-13 22:17:50 UTC (rev 23503) @@ -99,10 +99,10 @@ //fMouseBitmap = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "mouse_bmap"); //fMouseDownBitmap = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "pressed_mouse_bmap"); - if (fMouseDownBitmap != NULL) - fMouseDownBounds = fMouseDownBitmap->Bounds(); - else - fMouseDownBounds.Set(0, 0, 55, 29); + if (fMouseDownBitmap != NULL) + fMouseDownBounds = fMouseDownBitmap->Bounds(); + else + fMouseDownBounds.Set(0, 0, 55, 29); } From bonefish at mail.berlios.de Sun Jan 13 23:55:27 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 13 Jan 2008 23:55:27 +0100 Subject: [Haiku-commits] r23504 - haiku/trunk/src/kits/app Message-ID: <200801132255.m0DMtRJi025905@sheep.berlios.de> Author: bonefish Date: 2008-01-13 23:55:27 +0100 (Sun, 13 Jan 2008) New Revision: 23504 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23504&view=rev Modified: haiku/trunk/src/kits/app/Messenger.cpp Log: Clarified documentation of the "asynchronous" SendMessage() methods. Modified: haiku/trunk/src/kits/app/Messenger.cpp =================================================================== --- haiku/trunk/src/kits/app/Messenger.cpp 2008-01-13 22:17:50 UTC (rev 23503) +++ haiku/trunk/src/kits/app/Messenger.cpp 2008-01-13 22:55:27 UTC (rev 23504) @@ -245,10 +245,14 @@ // #pragma mark - Message sending // SendMessage -/*! \brief Delivers a BMessage synchronously to the messenger's target. +/*! \brief Delivers a BMessage synchronously to the messenger's target, + without waiting for a reply. - The method does not wait for a reply. The message is sent asynchronously. - + If the target's message port is full, the method waits indefinitely, until + space becomes available in the port. After delivery the method returns + immediately. It does not wait until the target processes the message or + even sends a reply. + \param command The what field of the message to deliver. \param replyTo The handler to which a reply to the message shall be sent. May be \c NULL. @@ -265,12 +269,16 @@ } // SendMessage -/*! \brief Delivers a BMessage synchronously to the messenger's target. +/*! \brief Delivers a BMessage synchronously to the messenger's target, + without waiting for a reply. A copy of the supplied message is sent and the caller retains ownership of \a message. - The method does not wait for a reply. The message is sent asynchronously. + If the target's message port is full, the method waits until space becomes + available in the port or the specified timeout occurs (whichever happens + first). After delivery the method returns immediately. It does not wait + until the target processes the message or even sends a reply. \param message The message to be sent. \param replyTo The handler to which a reply to the message shall be sent. @@ -300,12 +308,16 @@ } // SendMessage -/*! \brief Delivers a BMessage synchronously to the messenger's target. +/*! \brief Delivers a BMessage synchronously to the messenger's target, + without waiting for a reply. A copy of the supplied message is sent and the caller retains ownership of \a message. - The method does not wait for a reply. The message is sent asynchronously. + If the target's message port is full, the method waits until space becomes + available in the port or the specified timeout occurs (whichever happens + first). After delivery the method returns immediately. It does not wait + until the target processes the message or even sends a reply. \param message The message to be sent. \param replyTo A messenger specifying the target for a reply to \a message. From korli at mail.berlios.de Mon Jan 14 00:05:33 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 14 Jan 2008 00:05:33 +0100 Subject: [Haiku-commits] r23505 - in haiku/trunk/src/preferences: appearance backgrounds devices drivesetup keyboard keymap media menu screen screensaver sounds virtualmemory Message-ID: <200801132305.m0DN5XBF026718@sheep.berlios.de> Author: korli Date: 2008-01-14 00:05:30 +0100 (Mon, 14 Jan 2008) New Revision: 23505 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23505&view=rev Modified: haiku/trunk/src/preferences/appearance/Appearance.rdef haiku/trunk/src/preferences/backgrounds/BackgroundImage.cpp haiku/trunk/src/preferences/backgrounds/Backgrounds.rdef haiku/trunk/src/preferences/devices/ConfigurationWindow.cpp haiku/trunk/src/preferences/devices/Devices.cpp haiku/trunk/src/preferences/devices/Devices.rdef haiku/trunk/src/preferences/devices/DevicesInfo.cpp haiku/trunk/src/preferences/devices/DevicesInfo.h haiku/trunk/src/preferences/devices/DevicesWindow.cpp haiku/trunk/src/preferences/devices/DevicesWindows.h haiku/trunk/src/preferences/devices/ResourceUsageWindow.cpp haiku/trunk/src/preferences/devices/cm_wrapper.c haiku/trunk/src/preferences/drivesetup/DriveSetup.rdef haiku/trunk/src/preferences/drivesetup/MainWindow.cpp haiku/trunk/src/preferences/keyboard/Keyboard.rdef haiku/trunk/src/preferences/keyboard/KeyboardSettings.cpp haiku/trunk/src/preferences/keyboard/KeyboardWindow.cpp haiku/trunk/src/preferences/keymap/Keymap.cpp haiku/trunk/src/preferences/keymap/Keymap.rdef haiku/trunk/src/preferences/keymap/KeymapWindow.cpp haiku/trunk/src/preferences/media/Media.cpp haiku/trunk/src/preferences/media/MediaListItem.cpp haiku/trunk/src/preferences/media/MediaViews.cpp haiku/trunk/src/preferences/media/MediaViews.h haiku/trunk/src/preferences/media/MediaWindow.cpp haiku/trunk/src/preferences/media/MediaWindow.h haiku/trunk/src/preferences/media/media.rdef haiku/trunk/src/preferences/menu/Menu.rdef haiku/trunk/src/preferences/screen/Screen.rdef haiku/trunk/src/preferences/screensaver/ScreenSaverApp.cpp haiku/trunk/src/preferences/screensaver/ScreenSaverWindow.cpp haiku/trunk/src/preferences/sounds/HEventList.cpp haiku/trunk/src/preferences/sounds/HWindow.cpp haiku/trunk/src/preferences/sounds/Jamfile haiku/trunk/src/preferences/virtualmemory/VirtualMemory.rdef Log: style cleanup whitespace => tab Modified: haiku/trunk/src/preferences/appearance/Appearance.rdef =================================================================== --- haiku/trunk/src/preferences/appearance/Appearance.rdef 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/appearance/Appearance.rdef 2008-01-13 23:05:30 UTC (rev 23505) @@ -13,7 +13,7 @@ internal = 0, short_info = "Appearance", - long_info = "Appearance ?2002-2007 Haiku" + long_info = "Appearance ?2002-2007 Haiku" }; resource app_flags B_SINGLE_LAUNCH; Modified: haiku/trunk/src/preferences/backgrounds/BackgroundImage.cpp =================================================================== --- haiku/trunk/src/preferences/backgrounds/BackgroundImage.cpp 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/backgrounds/BackgroundImage.cpp 2008-01-13 23:05:30 UTC (rev 23505) @@ -313,8 +313,8 @@ followFlags, tile); view->Invalidate(); - /*if(fShowingBitmap != info) { - if(fShowingBitmap) + /*if (fShowingBitmap != info) { + if (fShowingBitmap) fShowingBitmap->UnloadBitmap(fCacheMode); fShowingBitmap = info; }*/ @@ -484,8 +484,8 @@ void BackgroundImage::ChangeImageSet(BPoseView *poseView) { - if(fRandomChange) { - if(fImageSetCount > 1) { + if (fRandomChange) { + if (fImageSetCount > 1) { uint32 oldShowingImageSet = fShowingImageSet; while(oldShowingImageSet == fShowingImageSet) fShowingImageSet = random()%fImageSetCount; @@ -493,7 +493,7 @@ fShowingImageSet = 0; } else { fShowingImageSet++; - if(fShowingImageSet > fImageSetCount - 1) + if (fShowingImageSet > fImageSetCount - 1) fShowingImageSet = 0; } Modified: haiku/trunk/src/preferences/backgrounds/Backgrounds.rdef =================================================================== --- haiku/trunk/src/preferences/backgrounds/Backgrounds.rdef 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/backgrounds/Backgrounds.rdef 2008-01-13 23:05:30 UTC (rev 23505) @@ -13,7 +13,7 @@ internal = 0, short_info = "Backgrounds", - long_info = "Backgrounds ?2002-2006 Haiku" + long_info = "Backgrounds ?2002-2006 Haiku" }; resource app_flags B_SINGLE_LAUNCH; Modified: haiku/trunk/src/preferences/devices/ConfigurationWindow.cpp =================================================================== --- haiku/trunk/src/preferences/devices/ConfigurationWindow.cpp 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/devices/ConfigurationWindow.cpp 2008-01-13 23:05:30 UTC (rev 23505) @@ -66,12 +66,12 @@ /*********************************************************** * DrawItem ***********************************************************/ -void +void RangeConfItem::DrawItem(BView *owner, BRect itemRect, bool complete) { rgb_color kBlack = { 0,0,0,0 }; rgb_color kHighlight = { 156,154,156,0 }; - + if (IsSelected() || complete) { rgb_color color; if (IsSelected()) @@ -83,7 +83,6 @@ owner->SetLowColor(color); owner->FillRect(itemRect); owner->SetHighColor(kBlack); - } else { owner->SetLowColor(owner->ViewColor()); } @@ -98,8 +97,8 @@ owner->MovePenTo(point); char string[20]; - - if (fLowAddress >= 0) { + + if (fLowAddress >= 0) { sprintf(string, "0x%04lx", fLowAddress); owner->DrawString(string); } @@ -111,8 +110,8 @@ point += BPoint(15, 0); owner->MovePenTo(point); owner->SetFont(be_plain_font); - - if (fHighAddress >= 0) { + + if (fHighAddress >= 0) { sprintf(string, "0x%04lx", fHighAddress); owner->DrawString(string); } @@ -141,10 +140,10 @@ ConfigurationWindow::ConfigurationWindow(BRect frame, DeviceItem *item) : BWindow (frame, item->GetInfo()->GetCardName(), B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL , B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE|B_NOT_RESIZABLE), - fItem(item) + fItem(item) { CenterWindowOnScreen(this); - fItem->SetWindow(this); + fItem->SetWindow(this); InitWindow(); Show(); @@ -173,12 +172,12 @@ BRect rtab = Bounds(); BRect rlist = Bounds(); rtab.top += 10; - rlist.top += 11; - rlist.left += 13; - rlist.right -= 13; - rlist.bottom -= 44; - - // Create the TabView and Tabs + rlist.top += 11; + rlist.left += 13; + rlist.right -= 13; + rlist.bottom -= 44; + + // Create the TabView and Tabs BTabView *tabView = new BTabView(rtab,"resource_usage_tabview"); tabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -188,8 +187,8 @@ // Create the Views BBox *resources = new BBox(rlist, "resources", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); - - + + BMenuItem *menuItem; fConfigurationMenu = new BPopUpMenu(""); fConfigurationMenu->AddItem(menuItem = new BMenuItem("Current Configuration", @@ -263,12 +262,12 @@ fDMAMenu[0]->Superitem()->SetLabel(""); fDMAMenu[1]->Superitem()->SetLabel(""); fDMAMenu[2]->Superitem()->SetLabel(""); - + BRect boxRect = resources->Bounds(); boxRect.top = 74; - boxRect.left += 13; - boxRect.right -= 11; - boxRect.bottom = boxRect.top + 141; + boxRect.left += 13; + boxRect.right -= 11; + boxRect.bottom = boxRect.top + 141; BBox *ioPortBox = new BBox(boxRect, "ioPort", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); ioPortBox->SetLabel(new BStringView(BRect(0,0,150,15), "ioPortLabel", " IO Port Ranges ")); @@ -348,7 +347,7 @@ for (int32 i=0;iAddItem(new RangeConfItem(r.d.r.minbase, r.d.r.minbase + r.d.r.len - 1)); } @@ -363,7 +362,7 @@ for (int32 i=0;iAddItem(new RangeConfItem(r.d.r.minbase, r.d.r.minbase + r.d.r.len - 1)); } @@ -374,7 +373,7 @@ BBox *info = new BBox(rlist, "info", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW, B_NO_BORDER); - + bool isISAPnP = false; BString compatibleIDString; @@ -384,14 +383,14 @@ && (((id >> 16) & 0xff) == 'n') && (((id >> 8) & 0xff) == 'P')) { isISAPnP = true; - + char string[255]; sprintf(string, "Compatible ID #%ld:", devicesInfo->GetInfo()->id[3]); compatibleIDString = string; } } - + BRect labelRect(1, 10, 132, 30); BStringView *label = new BStringView(labelRect, "Card Name", "Card Name:"); label->SetAlignment(B_ALIGN_RIGHT); @@ -429,7 +428,7 @@ label = new BStringView(labelRect, "Compatible ID#", compatibleIDString.String()); label->SetAlignment(B_ALIGN_RIGHT); info->AddChild(label); - } + } labelRect.OffsetBy(0, 18); label = new BStringView(labelRect, "Current State", "Current State:"); label->SetAlignment(B_ALIGN_RIGHT); @@ -469,7 +468,7 @@ BString logicalString; switch (devicesInfo->GetInfo()->bus) { - case B_ISA_BUS: + case B_ISA_BUS: { char string[255]; if (isISAPnP) { @@ -483,7 +482,7 @@ (uint8)(id >> 28) & 0xf, (uint8)((id >> 24) & 0xf)); vendor = string; - + sprintf(string, "%08lx", devicesInfo->GetInfo()->id[2]); cardID = string; @@ -509,7 +508,7 @@ (uint8)(id >> 16) & 0xf, (uint8)(id >> 20) & 0xf, (uint8)((id >> 24) & 0xff)); - vendor = string; + vendor = string; cardID = "0"; } @@ -537,7 +536,7 @@ break; } } - } + } break; case B_PCMCIA_BUS: vendor = "XX"; break; default: vendor = ""; break; @@ -590,7 +589,7 @@ label = new BStringView(labelRect, "Resource Conflicts", resourceConflicts.String()); info->AddChild(label); - + BTab *tab = new BTab(); tabView->AddTab(resources, tab); tab->SetLabel("Resources"); @@ -624,7 +623,7 @@ ConfigurationWindow::QuitRequested() { fItem->SetWindow(NULL); - return true; + return true; } // ---------------------------------------------------------------------------------------------------------- // Modified: haiku/trunk/src/preferences/devices/Devices.cpp =================================================================== --- haiku/trunk/src/preferences/devices/Devices.cpp 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/devices/Devices.cpp 2008-01-13 23:05:30 UTC (rev 23505) @@ -24,8 +24,8 @@ class Devices : public BApplication { public: - Devices(); - virtual void MessageReceived(BMessage *message); + Devices(); + virtual void MessageReceived(BMessage *message); private: @@ -47,20 +47,21 @@ { switch(message->what) { - default: - BApplication::MessageReceived(message); // pass it along ... - break; - } + default: + BApplication::MessageReceived(message); // pass it along ... + break; + } } // ---------------------------------------------------------------------------------------------------------- // // Devices Main -int main(void) +int +main(void) { - Devices theApp; - theApp.Run(); - return 0; + Devices theApp; + theApp.Run(); + return 0; } // end ------------------------------------------------------------------------------------------------------ // Modified: haiku/trunk/src/preferences/devices/Devices.rdef =================================================================== --- haiku/trunk/src/preferences/devices/Devices.rdef 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/devices/Devices.rdef 2008-01-13 23:05:30 UTC (rev 23505) @@ -14,7 +14,7 @@ internal = 0, short_info = "Devices", - long_info = "Devices ?2002-2007 Haiku" + long_info = "Devices ?2002-2007 Haiku" }; resource app_flags B_SINGLE_LAUNCH; Modified: haiku/trunk/src/preferences/devices/DevicesInfo.cpp =================================================================== --- haiku/trunk/src/preferences/devices/DevicesInfo.cpp 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/devices/DevicesInfo.cpp 2008-01-13 23:05:30 UTC (rev 23505) @@ -202,7 +202,7 @@ owner->MovePenTo(point); owner->DrawString(fName); - if(fInfo) { + if (fInfo) { point += BPoint(222, 0); BString string = "enabled"; if (!(fInfo->GetInfo()->flags & B_DEVICE_INFO_ENABLED)) Modified: haiku/trunk/src/preferences/devices/DevicesInfo.h =================================================================== --- haiku/trunk/src/preferences/devices/DevicesInfo.h 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/devices/DevicesInfo.h 2008-01-13 23:05:30 UTC (rev 23505) @@ -23,10 +23,10 @@ class DevicesInfo { public: - DevicesInfo(struct device_info *info, - struct device_configuration *current, - struct possible_device_configurations *possible); - ~DevicesInfo(); + DevicesInfo(struct device_info *info, + struct device_configuration *current, + struct possible_device_configurations *possible); + ~DevicesInfo(); struct device_info * GetInfo() { return fInfo;} char * GetDeviceName() const { return fDeviceName; } char * GetCardName() const { return fCardName; } Modified: haiku/trunk/src/preferences/devices/DevicesWindow.cpp =================================================================== --- haiku/trunk/src/preferences/devices/DevicesWindow.cpp 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/devices/DevicesWindow.cpp 2008-01-13 23:05:30 UTC (rev 23505) @@ -69,25 +69,25 @@ CenterWindowOnScreen(this); // Load User Settings - BPath path; - find_directory(B_USER_SETTINGS_DIRECTORY,&path); - path.Append("Devices_Settings",true); - BFile file(path.Path(),B_READ_ONLY); - BMessage msg; - msg.Unflatten(&file); - LoadSettings (&msg); - - status_t error; + BPath path; + find_directory(B_USER_SETTINGS_DIRECTORY,&path); + path.Append("Devices_Settings",true); + BFile file(path.Path(),B_READ_ONLY); + BMessage msg; + msg.Unflatten(&file); + LoadSettings (&msg); + + status_t error; if ((error = init_cm_wrapper()) < 0) { printf("Error initializing configuration manager (%s)\n", strerror(error)); exit(1); } - - InitDevices(B_ISA_BUS); - InitDevices(B_PCI_BUS); - - for (int32 i=fList.CountItems()-1; i>=0; i--) { + + InitDevices(B_ISA_BUS); + InitDevices(B_PCI_BUS); + + for (int32 i=fList.CountItems()-1; i>=0; i--) { DevicesInfo *deviceInfo = (DevicesInfo *) fList.ItemAt(i); struct device_info *info = deviceInfo->GetInfo(); BListItem *item = systemMenu; @@ -253,7 +253,7 @@ { SaveSettings(); be_app->PostMessage(B_QUIT_REQUESTED); - return true; + return true; } // ---------------------------------------------------------------------------------------------------------- // @@ -277,12 +277,12 @@ BMessage msg; msg.AddRect("windowframe",Frame()); - BPath path; - status_t result = find_directory(B_USER_SETTINGS_DIRECTORY,&path); - if (result == B_OK) - { + BPath path; + status_t result = find_directory(B_USER_SETTINGS_DIRECTORY,&path); + if (result == B_OK) + { path.Append("Devices_Settings",true); - BFile file(path.Path(),B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE); + BFile file(path.Path(),B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE); msg.Flatten(&file); } } Modified: haiku/trunk/src/preferences/devices/DevicesWindows.h =================================================================== --- haiku/trunk/src/preferences/devices/DevicesWindows.h 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/devices/DevicesWindows.h 2008-01-13 23:05:30 UTC (rev 23505) @@ -35,10 +35,10 @@ class ResourceUsageWindow : public BWindow { public: - ResourceUsageWindow(BRect frame, BList &); - ~ResourceUsageWindow(); - virtual void MessageReceived(BMessage *message); - + ResourceUsageWindow(BRect frame, BList &); + ~ResourceUsageWindow(); + virtual void MessageReceived(BMessage *message); + private: void InitWindow(BList &); }; @@ -46,19 +46,19 @@ class ModemWindow : public BWindow { public: - ModemWindow(BRect frame, BMessenger); - ~ModemWindow(); - virtual void MessageReceived(BMessage *message); + ModemWindow(BRect frame, BMessenger); + ~ModemWindow(); + virtual void MessageReceived(BMessage *message); private: void InitWindow(void); - BMessenger fMessenger; + BMessenger fMessenger; }; class ConfigurationWindow : public BWindow { public: ConfigurationWindow(BRect frame, DeviceItem *item); - ~ConfigurationWindow(); - virtual bool QuitRequested(); + ~ConfigurationWindow(); + virtual bool QuitRequested(); virtual void MessageReceived(BMessage *message); private: void InitWindow(void); @@ -74,9 +74,9 @@ class DevicesWindow : public BWindow { public: - DevicesWindow(BRect frame); - ~DevicesWindow(); - virtual bool QuitRequested(); + DevicesWindow(BRect frame); + ~DevicesWindow(); + virtual bool QuitRequested(); virtual void MessageReceived(BMessage *message); private: void InitWindow(void); @@ -89,19 +89,19 @@ ResourceUsageWindow* ptrResourceUsageWindow; ModemWindow* ptrModemWindow; - BStringView *stvDeviceName; - BStringView *stvCurrentState; - BMenuBar *menubar; - - BList fList; - - BListItem *systemMenu, *isaMenu, *pciMenu, *jumperedMenu; - BOutlineListView *outline; - BStringView *stvIRQ; + BStringView *stvDeviceName; + BStringView *stvCurrentState; + BMenuBar *menubar; + + BList fList; + + BListItem *systemMenu, *isaMenu, *pciMenu, *jumperedMenu; + BOutlineListView *outline; + BStringView *stvIRQ; BStringView *stvDMA; BStringView *stvIORanges; BStringView *stvMemoryRanges; - BButton *btnConfigure; + BButton *btnConfigure; }; #endif Modified: haiku/trunk/src/preferences/devices/ResourceUsageWindow.cpp =================================================================== --- haiku/trunk/src/preferences/devices/ResourceUsageWindow.cpp 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/devices/ResourceUsageWindow.cpp 2008-01-13 23:05:30 UTC (rev 23505) @@ -52,12 +52,12 @@ /*********************************************************** * DrawItem ***********************************************************/ -void +void IRQDMAItem::DrawItem(BView *owner, BRect itemRect, bool complete) { rgb_color kBlack = { 0,0,0,0 }; rgb_color kHighlight = { 156,154,156,0 }; - + if (IsSelected() || complete) { rgb_color color; if (IsSelected()) @@ -122,12 +122,12 @@ /*********************************************************** * DrawItem ***********************************************************/ -void +void RangeItem::DrawItem(BView *owner, BRect itemRect, bool complete) { rgb_color kBlack = { 0,0,0,0 }; rgb_color kHighlight = { 156,154,156,0 }; - + if (IsSelected() || complete) { rgb_color color; if (IsSelected()) @@ -208,12 +208,12 @@ BRect rtab = Bounds(); BRect rlist = Bounds(); rtab.top += 10; - rlist.top += 10; - rlist.left += 12; - rlist.right -= 15 + B_V_SCROLL_BAR_WIDTH; - rlist.bottom -= 47; - - // Create the TabView and Tabs + rlist.top += 10; + rlist.left += 12; + rlist.right -= 15 + B_V_SCROLL_BAR_WIDTH; + rlist.bottom -= 47; + + // Create the TabView and Tabs BTabView *tabView = new BTabView(rtab,"resource_usage_tabview"); tabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -229,7 +229,7 @@ B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); BListView *memoryListView = new BListView(rlist, "memoryListView", B_SINGLE_SELECTION_LIST, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); - + BScrollView *IRQScrollView = new BScrollView("scroll_list1", IRQListView, B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true, B_FANCY_BORDER); BScrollView *DMAScrollView = new BScrollView("scroll_list2", DMAListView, B_FOLLOW_LEFT|B_FOLLOW_TOP, @@ -251,18 +251,18 @@ tab = new BTab(); tabView->AddTab(memoryScrollView, tab); tab->SetLabel("Memory Range"); - + { uint32 mask = 1; for (int i=0;i<16;mask<<=1,i++) { bool first = true; - + for (int32 j=0; jGetCurrent(); resource_descriptor r; - + int32 num = count_resource_descriptors_of_type(current, B_IRQ_RESOURCE); for (int32 k=0;kAddItem(new IRQDMAItem(first ? i : -1, deviceInfo->GetCardName())); + IRQListView->AddItem(new IRQDMAItem(first ? i : -1, deviceInfo->GetCardName())); first = false; } } @@ -287,12 +287,12 @@ for (int i=0;i<8;mask<<=1,i++) { bool first = true; - + for (int32 j=0; jGetCurrent(); resource_descriptor r; - + int32 num = count_resource_descriptors_of_type(current, B_DMA_RESOURCE); for (int32 k=0;kAddItem(new IRQDMAItem(first ? i : -1, deviceInfo->GetCardName())); + DMAListView->AddItem(new IRQDMAItem(first ? i : -1, deviceInfo->GetCardName())); first = false; } } @@ -317,7 +317,7 @@ DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j); struct device_configuration *current = deviceInfo->GetCurrent(); resource_descriptor r; - + int32 num = count_resource_descriptors_of_type(current, B_IO_PORT_RESOURCE); for (int32 k=0;kGetCurrent(); resource_descriptor r; - + int32 num = count_resource_descriptors_of_type(current, B_MEMORY_RESOURCE); for (int32 k=0;kPostMessage(B_QUIT_REQUESTED); - Hide(); + be_app->PostMessage(B_QUIT_REQUESTED); + Hide(); return false; } Modified: haiku/trunk/src/preferences/keyboard/Keyboard.rdef =================================================================== --- haiku/trunk/src/preferences/keyboard/Keyboard.rdef 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/keyboard/Keyboard.rdef 2008-01-13 23:05:30 UTC (rev 23505) @@ -15,7 +15,7 @@ internal = 0, short_info = "Keyboard", - long_info = "Keyboard ?2004-2007 Haiku" + long_info = "Keyboard ?2004-2007 Haiku" }; #ifdef HAIKU_TARGET_PLATFORM_HAIKU Modified: haiku/trunk/src/preferences/keyboard/KeyboardSettings.cpp =================================================================== --- haiku/trunk/src/preferences/keyboard/KeyboardSettings.cpp 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/keyboard/KeyboardSettings.cpp 2008-01-13 23:05:30 UTC (rev 23505) @@ -36,12 +36,12 @@ fCorner.y = 100; status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path); - if(status == B_OK) { + if (status == B_OK) { status = path.Append(kb_settings_file); - if(status == B_OK) { + if (status == B_OK) { status = file.SetTo(path.Path(), B_READ_ONLY); if (status == B_OK) { - if(file.ReadAt(sizeof(kb_settings), &fCorner, sizeof(fCorner)) != sizeof(fCorner)) { + if (file.ReadAt(sizeof(kb_settings), &fCorner, sizeof(fCorner)) != sizeof(fCorner)) { fCorner.x = 150; fCorner.y = 100; } Modified: haiku/trunk/src/preferences/keyboard/KeyboardWindow.cpp =================================================================== --- haiku/trunk/src/preferences/keyboard/KeyboardWindow.cpp 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/keyboard/KeyboardWindow.cpp 2008-01-13 23:05:30 UTC (rev 23505) @@ -23,7 +23,7 @@ KeyboardWindow::KeyboardWindow() : BWindow(BRect(0, 0, 200, 200), "Keyboard", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) -{ +{ MoveTo(fSettings.WindowCorner()); // center window if it would be off-screen @@ -50,7 +50,7 @@ button->SetEnabled(fSettings.IsDefaultable()); #ifdef DEBUG - fSettings.Dump(); + fSettings.Dump(); #endif Show(); @@ -63,7 +63,7 @@ fSettings.SetWindowCorner(Frame().LeftTop()); #ifdef DEBUG - fSettings.Dump(); + fSettings.Dump(); #endif be_app->PostMessage(B_QUIT_REQUESTED); @@ -105,11 +105,11 @@ slider = (BSlider *)FindView("key_repeat_rate"); if (slider !=NULL) - slider->SetValue(fSettings.KeyboardRepeatRate()); + slider->SetValue(fSettings.KeyboardRepeatRate()); slider = (BSlider *)FindView("delay_until_key_repeat"); if (slider !=NULL) - slider->SetValue(fSettings.KeyboardRepeatDelay()); + slider->SetValue(fSettings.KeyboardRepeatDelay()); button = (BButton *)FindView("keyboard_defaults"); if (button !=NULL) @@ -119,7 +119,7 @@ if (button !=NULL) button->SetEnabled(false); break; - } + } case SLIDER_REPEAT_RATE: { int32 rate; @@ -133,7 +133,7 @@ button = (BButton *)FindView("keyboard_revert"); if (button !=NULL) - button->SetEnabled(true); + button->SetEnabled(true); break; } case SLIDER_DELAY_RATE: @@ -165,10 +165,10 @@ button->SetEnabled(fSettings.IsDefaultable()); button = (BButton *)FindView("keyboard_revert"); - if (button !=NULL) - button->SetEnabled(true); + if (button !=NULL) + button->SetEnabled(true); break; - } + } default: BWindow::MessageReceived(message); Modified: haiku/trunk/src/preferences/keymap/Keymap.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/Keymap.cpp 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/keymap/Keymap.cpp 2008-01-13 23:05:30 UTC (rev 23505) @@ -21,34 +21,34 @@ #include static void -print_key( char *chars, int32 offset ) +print_key(char *chars, int32 offset) { int size = chars[offset++]; - switch( size ) { + switch(size) { case 0: // Not mapped - printf( "N/A" ); + printf("N/A"); break; case 1: // 1-byte UTF-8/ASCII character - printf( "%c", chars[offset] ); + printf("%c", chars[offset]); break; default: // 2-, 3-, or 4-byte UTF-8 character { char *str = new char[size + 1]; - strncpy( str, &(chars[offset]), size ); + strncpy(str, &(chars[offset]), size); str[size] = 0; - printf( "%s", str ); + printf("%s", str); delete [] str; } break; } - printf( "\t" ); + printf("\t"); } @@ -57,19 +57,19 @@ { // Print a chart of the normal, shift, option, and option+shift // keys. - printf( "Key #\tNormal\tShift\tCaps\tC+S\tOption\tO+S\tO+C\tO+C+S\tControl\n" ); - for( int idx = 0; idx < 128; idx++ ) { - printf( " 0x%x\t", idx ); - print_key( fChars, fKeys.normal_map[idx] ); - print_key( fChars, fKeys.shift_map[idx] ); - print_key( fChars, fKeys.caps_map[idx] ); - print_key( fChars, fKeys.caps_shift_map[idx] ); - print_key( fChars, fKeys.option_map[idx] ); - print_key( fChars, fKeys.option_shift_map[idx] ); - print_key( fChars, fKeys.option_caps_map[idx] ); - print_key( fChars, fKeys.option_caps_shift_map[idx] ); - print_key( fChars, fKeys.control_map[idx] ); - printf( "\n" ); + printf("Key #\tNormal\tShift\tCaps\tC+S\tOption\tO+S\tO+C\tO+C+S\tControl\n"); + for (int idx = 0; idx < 128; idx++) { + printf(" 0x%x\t", idx ); + print_key(fChars, fKeys.normal_map[idx]); + print_key(fChars, fKeys.shift_map[idx]); + print_key(fChars, fKeys.caps_map[idx]); + print_key(fChars, fKeys.caps_shift_map[idx]); + print_key(fChars, fKeys.option_map[idx]); + print_key(fChars, fKeys.option_shift_map[idx]); + print_key(fChars, fKeys.option_caps_map[idx]); + print_key(fChars, fKeys.option_caps_shift_map[idx]); + print_key(fChars, fKeys.control_map[idx]); + printf("\n"); } } @@ -371,7 +371,7 @@ if (strncmp(&(fChars[offset+1]), &(fChars[dead_key[i]+1]), *numBytes ) == 0) { *numBytes = fChars[dead_key[i+1]]; - switch( *numBytes ) { + switch(*numBytes) { case 0: // Not mapped *chars = NULL; Modified: haiku/trunk/src/preferences/keymap/Keymap.rdef =================================================================== --- haiku/trunk/src/preferences/keymap/Keymap.rdef 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/keymap/Keymap.rdef 2008-01-13 23:05:30 UTC (rev 23505) @@ -13,7 +13,7 @@ internal = 0, short_info = "Keymap", - long_info = "Keymap ?2004-2006 Haiku" + long_info = "Keymap ?2004-2006 Haiku" }; resource app_flags B_SINGLE_LAUNCH; Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2008-01-13 22:55:27 UTC (rev 23504) +++ haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2008-01-13 23:05:30 UTC (rev 23505) @@ -92,7 +92,7 @@ entry_ref ref; get_ref_for_path(path.Path(), &ref); - + fOpenPanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(this), &ref, B_FILE_NODE, false, NULL); fSavePanel = new BFilePanel(B_SAVE_PANEL, new BMessenger(this), &ref, @@ -156,7 +156,7 @@ menubar->AddItem( menu ); // Create the Font menu - fFontMenu = new BMenu( "Font" ); + fFontMenu = new BMenu("Font"); fFontMenu->SetRadioMode(true); int32 numFamilies = count_font_families(); font_family family, current_family; @@ -164,16 +164,16 @@ uint32 flags; be_plain_font->GetFamilyAndStyle(¤t_family, ¤t_style); - + for (int32 i = 0; i < numFamilies; i++ ) - if ( get_font_family(i, &family, &flags) == B_OK ) { + if (get_font_family(i, &family, &flags) == B_OK) { BMenuItem *item = new BMenuItem(family, new BMessage( MENU_FONT_CHANGED)); fFontMenu->AddItem(item); - if(strcmp(family, current_family) == 0) + if (strcmp(family, current_family) == 0) item->SetMarked(true); } - menubar->AddItem( fFontMenu ); + menubar->AddItem(fFontMenu); return menubar; } @@ -207,13 +207,13 @@ fUserListView = new BListView( bounds, "userList" ); // '(Current)' KeymapListItem *currentKeymapItem = (KeymapListItem*)fUserListView->FirstItem(); - if( currentKeymapItem != NULL ) + if (currentKeymapItem != NULL) fUserListView->AddItem( currentKeymapItem ); // Saved keymaps mapsBox->AddChild( new BScrollView( "userScrollList", fUserListView, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true )); fUserListView->SetSelectionMessage( new BMessage( USER_MAP_SELECTED )); - + FillSystemMaps(); FillUserMaps(); @@ -245,7 +245,7 @@ fMapView->Invalidate(); fSystemListView->DeselectAll(); fUserListView->DeselectAll(); - } + } break; case B_SAVE_REQUESTED: { [... truncated: 1302 lines follow ...] From colacoder at mail.berlios.de Mon Jan 14 00:47:36 2008 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Mon, 14 Jan 2008 00:47:36 +0100 Subject: [Haiku-commits] r23506 - haiku/trunk/src/kits/interface Message-ID: <200801132347.m0DNlatX030795@sheep.berlios.de> Author: colacoder Date: 2008-01-14 00:47:35 +0100 (Mon, 14 Jan 2008) New Revision: 23506 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23506&view=rev Modified: haiku/trunk/src/kits/interface/PrintJob.cpp Log: Fix BPrintJob to not screw up user-made job settings with the global defaults.... StyledEdit prints again :) Modified: haiku/trunk/src/kits/interface/PrintJob.cpp =================================================================== --- haiku/trunk/src/kits/interface/PrintJob.cpp 2008-01-13 23:05:30 UTC (rev 23505) +++ haiku/trunk/src/kits/interface/PrintJob.cpp 2008-01-13 23:47:35 UTC (rev 23506) @@ -797,9 +797,11 @@ BMessage *reply = new BMessage; printServer.SendMessage(&message, reply); - - _HandlePrintSetup(reply); - + + // Only override our settings if we don't have any settings yet + if (fSetupMessage == NULL) + _HandlePrintSetup(reply); + delete fDefaultSetupMessage; fDefaultSetupMessage = reply; } From mmu_man at mail.berlios.de Mon Jan 14 02:58:52 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Mon, 14 Jan 2008 02:58:52 +0100 Subject: [Haiku-commits] r23507 - haiku/trunk/headers/build Message-ID: <200801140158.m0E1wq1U024910@sheep.berlios.de> Author: mmu_man Date: 2008-01-14 02:58:51 +0100 (Mon, 14 Jan 2008) New Revision: 23507 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23507&view=rev Modified: haiku/trunk/headers/build/HaikuBuildCompatibility.h Log: Some more bone compatibility. Modified: haiku/trunk/headers/build/HaikuBuildCompatibility.h =================================================================== --- haiku/trunk/headers/build/HaikuBuildCompatibility.h 2008-01-13 23:47:35 UTC (rev 23506) +++ haiku/trunk/headers/build/HaikuBuildCompatibility.h 2008-01-14 01:58:51 UTC (rev 23507) @@ -133,6 +133,12 @@ #endif #endif +#if defined(HAIKU_TARGET_PLATFORM_BONE) || defined(HAIKU_TARGET_PLATFORM_DANO) +# define IF_NAMESIZE IFNAMSIZ +# define ifc_value ifc_val +# define IFF_AUTO_CONFIGURED 0 +#endif + #ifndef INT64_MAX #include #define INT64_MAX LONGLONG_MAX From mmu_man at mail.berlios.de Mon Jan 14 03:00:44 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Mon, 14 Jan 2008 03:00:44 +0100 Subject: [Haiku-commits] r23508 - in haiku/trunk/3rdparty/mmu_man/themes: . addons Message-ID: <200801140200.m0E20ikq025196@sheep.berlios.de> Author: mmu_man Date: 2008-01-14 03:00:42 +0100 (Mon, 14 Jan 2008) New Revision: 23508 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23508&view=rev Modified: haiku/trunk/3rdparty/mmu_man/themes/Jamfile haiku/trunk/3rdparty/mmu_man/themes/TextInputAlert.cpp haiku/trunk/3rdparty/mmu_man/themes/TextInputAlert.h haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.h haiku/trunk/3rdparty/mmu_man/themes/ThemeManager.cpp haiku/trunk/3rdparty/mmu_man/themes/Themes.rdef haiku/trunk/3rdparty/mmu_man/themes/ThemesAddon.cpp haiku/trunk/3rdparty/mmu_man/themes/ThemesApp.cpp haiku/trunk/3rdparty/mmu_man/themes/Utils.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp Log: * Fix use of FindData(), now we can find colors and fonts! * Implemented a text input box to name a new theme. * Made loading of themes asynchronous in a thread, controls are disabled but at least the window appears ASAP. * fixed app sig * Implemented setting colors and fonts on Haiku. * Implemented setting the window decor, but doesn't work as we don't have any decorator installed. * Enable all addons. TODO: forbid quitting while themes are loading! Modified: haiku/trunk/3rdparty/mmu_man/themes/Jamfile =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/Jamfile 2008-01-14 01:58:51 UTC (rev 23507) +++ haiku/trunk/3rdparty/mmu_man/themes/Jamfile 2008-01-14 02:00:42 UTC (rev 23508) @@ -2,6 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; +#SubDirC++Flags -DSINGLE_BINARY -DDEBUG=1 ; SubDirC++Flags -DSINGLE_BINARY ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) 3rdparty mmu_man themes addons ] ; Modified: haiku/trunk/3rdparty/mmu_man/themes/TextInputAlert.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/TextInputAlert.cpp 2008-01-14 01:58:51 UTC (rev 23507) +++ haiku/trunk/3rdparty/mmu_man/themes/TextInputAlert.cpp 2008-01-14 02:00:42 UTC (rev 23508) @@ -1,6 +1,13 @@ +//HACK :P +#define private public +#include +#undef private + #include "TextInputAlert.h" +#define TEXT_HEIGHT 25 + TextInputAlert::TextInputAlert(const char *title, const char *text, const char *initial, /* initial input value */ @@ -11,6 +18,17 @@ alert_type type) : BAlert(title, text, button0Label, button1Label, button2Label, widthStyle, type) { + ResizeBy(0,TEXT_HEIGHT); + BRect f = Bounds(); + f.InsetBySelf(TEXT_HEIGHT, f.Height()/4 - TEXT_HEIGHT/2); + f.left *= 3; + fText = new BTextControl(f, "text", "Name:", initial, NULL); + fText->SetDivider(f.Width()/3); + ChildAt(0)->AddChild(fText); + TextView()->Hide(); + fText->SetViewColor(ChildAt(0)->ViewColor()); + fText->SetLowColor(ChildAt(0)->LowColor()); + fText->TextView()->SelectAll(); } @@ -19,3 +37,10 @@ } +void +TextInputAlert::Show() +{ + BAlert::Show(); +} + + Modified: haiku/trunk/3rdparty/mmu_man/themes/TextInputAlert.h =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/TextInputAlert.h 2008-01-14 01:58:51 UTC (rev 23507) +++ haiku/trunk/3rdparty/mmu_man/themes/TextInputAlert.h 2008-01-14 02:00:42 UTC (rev 23508) @@ -2,6 +2,7 @@ #define TEXT_INPUT_ALERT_H #include +#include class TextInputAlert : public BAlert { public: @@ -14,7 +15,14 @@ button_width widthStyle = B_WIDTH_AS_USUAL, alert_type type = B_INFO_ALERT); virtual ~TextInputAlert(); + virtual void Show(); + + const char *Text() const { return fText->Text(); }; + BTextControl *TextControl() const { return fText; }; + + private: + BTextControl *fText; }; #endif /* TEXT_INPUT_ALERT_H */ Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp 2008-01-14 01:58:51 UTC (rev 23507) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp 2008-01-14 02:00:42 UTC (rev 23508) @@ -77,6 +77,49 @@ } // ------------------------------------------------------------------------------ +class MyInvoker : public BInvoker { + public: + MyInvoker(BMessage* message, const BHandler* handler, const BLooper* looper = NULL); + virtual ~MyInvoker(); + virtual status_t Invoke(BMessage* message = NULL); + void SetOwner(TextInputAlert *alert); + private: + TextInputAlert *fOwner; +}; + + +MyInvoker::MyInvoker(BMessage* message, const BHandler* handler, const BLooper* looper = NULL) + : BInvoker(message, handler, looper) +{ +} + + +MyInvoker::~MyInvoker() +{ +} + + +status_t +MyInvoker::Invoke(BMessage* message) +{ + BMessage *out = Message(); + if (out) { + if (out->ReplaceString("text", fOwner->TextControl()->TextView()->Text()) == B_OK || + out->AddString("text", fOwner->TextControl()->TextView()->Text()) == B_OK) + return BInvoker::Invoke(); + } + return EINVAL; +} + + +void +MyInvoker::SetOwner(TextInputAlert *alert) +{ + fOwner = alert; +} + + +// ------------------------------------------------------------------------------ //extern "C" BView *get_pref_view(const BRect& Bounds) extern "C" BView *themes_pref(const BRect& Bounds) { @@ -113,7 +156,7 @@ { BView::AllAttached(); - fPopupInvoker = new BInvoker(new BMessage(kReallyCreateTheme), this); + fPopupInvoker = new MyInvoker(new BMessage(kReallyCreateTheme), this); #ifdef B_BEOS_VERSION_DANO SetViewUIColor(B_UI_PANEL_BACKGROUND_COLOR); #else @@ -121,7 +164,6 @@ #endif fThemeManager = new ThemeManager; - fThemeManager->LoadThemes(); BRect frame = Bounds(); frame.InsetBy(10.0, 10.0); @@ -233,8 +275,8 @@ fAddonList->SetTarget(this); fAddonListSV->Hide(); + PopulateAddonList(); PopulateThemeList(); - PopulateAddonList(); } // ------------------------------------------------------------------------------ @@ -269,7 +311,8 @@ case kCreateThemeBtn: { - TextInputAlert *alert = new TextInputAlert("New name", "New Theme Name", "", "Ok", "Cancel"); + TextInputAlert *alert = new TextInputAlert("New name", "New Theme Name", "My Theme", "Ok"); + fPopupInvoker->SetOwner(alert); alert->Go(fPopupInvoker); break; } @@ -427,22 +470,60 @@ // ------------------------------------------------------------------------------ void ThemeInterfaceView::PopulateThemeList() { + int i; + BControl *c; + for (i = 0; ChildAt(i); i++) { + c = dynamic_cast(ChildAt(i)); + if (c) + c->SetEnabled(false); + } + thread_id tid = spawn_thread(_ThemeListPopulatorTh, "", B_LOW_PRIORITY, this); + resume_thread(tid); +} + +// ------------------------------------------------------------------------------ +int32 ThemeInterfaceView::_ThemeListPopulatorTh(void *arg) +{ + ThemeInterfaceView *_this = (ThemeInterfaceView *)arg; + _this->_ThemeListPopulator(); + return 0; +} + +// ------------------------------------------------------------------------------ +void ThemeInterfaceView::_ThemeListPopulator() +{ status_t err; int32 i, count; BString name; ThemeItem *ti; bool isro; + ThemeManager* tman = GetThemeManager(); + tman->LoadThemes(); + count = tman->CountThemes(); + LockLooper(); fThemeList->MakeEmpty(); + UnlockLooper(); for (i = 0; i < count; i++) { err = tman->ThemeName(i, name); isro = tman->ThemeIsReadOnly(i); if (err) continue; ti = new ThemeItem(i, name.String(), isro); + LockLooper(); fThemeList->AddItem(ti); + UnlockLooper(); } + + BControl *c; + LockLooper(); + for (i = 0; ChildAt(i); i++) { + c = dynamic_cast(ChildAt(i)); + if (c) + c->SetEnabled(true); + } + UnlockLooper(); } // ------------------------------------------------------------------------------ Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.h =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.h 2008-01-14 01:58:51 UTC (rev 23507) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.h 2008-01-14 02:00:42 UTC (rev 23508) @@ -16,7 +16,7 @@ class BTextView; class BMessage; class BStringView; -class BInvoker; +class MyInvoker; class ThemeInterfaceView : public BView { @@ -49,12 +49,14 @@ status_t AError(const char *func, status_t err); private: - + static int32 _ThemeListPopulatorTh(void *arg); + void _ThemeListPopulator(); + ThemeManager* fThemeManager; bool fScreenshotPaneHidden; bool fHasScreenshot; - BInvoker* fPopupInvoker; + MyInvoker* fPopupInvoker; BScrollView* fThemeListSV; BListView* fThemeList; BButton* fApplyBtn; Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemeManager.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemeManager.cpp 2008-01-14 01:58:51 UTC (rev 23507) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemeManager.cpp 2008-01-14 02:00:42 UTC (rev 23508) @@ -30,8 +30,10 @@ extern status_t MakeScreenshot(BBitmap **here); +// addons used in the prefs in Zeta (some were disabled) +//#define ZETA_ADDONS -#define DEBUG_TM +//#define DEBUG_TM #ifdef DEBUG_TM #define FENTRY PRINT(("ThemeManager::%s()\n", __FUNCTION__)) #else @@ -161,48 +163,43 @@ //if (err) return err; } #else + +#define ADDA(a) \ + if (ta) { \ + fAddonList.AddItem((void *)ta); \ + PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); \ + } + + ta = instanciate_themes_addon_backgrounds(); - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); + ADDA(ta); ta = instanciate_themes_addon_beide(); - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); + ADDA(ta); ta = instanciate_themes_addon_deskbar(); - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); -#if 0 + ADDA(ta); +#ifndef ZETA_ADDONS ta = instanciate_themes_addon_eddie(); - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); + ADDA(ta); #endif ta = instanciate_themes_addon_pe(); - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); + ADDA(ta); ta = instanciate_themes_addon_screensaver(); - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); -#if 0 + ADDA(ta); +#ifndef ZETA_ADDONS ta = instanciate_themes_addon_soundplay(); - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); + ADDA(ta); #endif ta = instanciate_themes_addon_sounds(); - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); ta = instanciate_themes_addon_terminal(); - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); + ADDA(ta); ta = instanciate_themes_addon_ui_settings(); - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); -#if 0 + ADDA(ta); +#ifndef ZETA_ADDONS ta = instanciate_themes_addon_winamp_skin(); - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); + ADDA(ta); #endif ta = instanciate_themes_addon_window_decor(); - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); + ADDA(ta); #endif //if (err) return err; fAddonCount = fAddonList.CountItems(); Modified: haiku/trunk/3rdparty/mmu_man/themes/Themes.rdef =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/Themes.rdef 2008-01-14 01:58:51 UTC (rev 23507) +++ haiku/trunk/3rdparty/mmu_man/themes/Themes.rdef 2008-01-14 02:00:42 UTC (rev 23508) @@ -1,5 +1,5 @@ -resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.mmu_man.Themes"; +resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.mmu_man-Themes"; resource app_version { major = 0, Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemesAddon.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemesAddon.cpp 2008-01-14 01:58:51 UTC (rev 23507) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemesAddon.cpp 2008-01-14 02:00:42 UTC (rev 23508) @@ -113,14 +113,17 @@ { FENTRY; BMessage msg; - status_t err; + status_t err = B_NAME_NOT_FOUND; if (!MessageName()) - return B_NAME_NOT_FOUND; + goto error; err = theme.FindMessage(MessageName(), &msg); if (err) - return err; + goto error; mine = msg; + return B_OK; +error: + return err; } status_t ThemesAddon::SetMyMessage(BMessage &theme, BMessage &mine) Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemesApp.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemesApp.cpp 2008-01-14 01:58:51 UTC (rev 23507) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemesApp.cpp 2008-01-14 02:00:42 UTC (rev 23508) @@ -25,7 +25,7 @@ ThemesApp::ReadyToRun() { BScreen s; - BRect frame(0, 0, 500, 300); + BRect frame(0, 0, 550, 300); frame.OffsetBySelf(s.Frame().Width()/2 - frame.Width()/2, s.Frame().Height()/2 - frame.Height()/2); BWindow *w = new BWindow(frame, "Themes", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_QUIT_ON_WINDOW_CLOSE); Modified: haiku/trunk/3rdparty/mmu_man/themes/Utils.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/Utils.cpp 2008-01-14 01:58:51 UTC (rev 23507) +++ haiku/trunk/3rdparty/mmu_man/themes/Utils.cpp 2008-01-14 02:00:42 UTC (rev 23508) @@ -286,7 +286,7 @@ const void *data; ssize_t len; status_t err; - err = message.FindData(name, index, &data, &len); + err = message.FindData(name, B_RGB_COLOR_TYPE, index, &data, &len); if (err < B_OK) return err; if (len > (ssize_t)sizeof(*c)) @@ -317,7 +317,8 @@ #else const void *data; ssize_t len; - status_t err = message.FindData(name, index, &data, &len); + status_t err = message.FindData(name, 'FONt', index, &data, &len); +#define DERR(e) { PRINT(("%s: err: %s\n", __FUNCTION__, strerror(e))); } if (err < B_OK) return err; if (len > (ssize_t)sizeof(*f)) Modified: haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp 2008-01-14 01:58:51 UTC (rev 23507) +++ haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp 2008-01-14 02:00:42 UTC (rev 23508) @@ -12,26 +12,35 @@ #include #include #include +#include #include #include #include "ThemesAddon.h" #include "UITheme.h" +#include "Utils.h" #ifdef SINGLE_BINARY #define instanciate_themes_addon instanciate_themes_addon_ui_settings #endif -//XXX: FIXME -ThemesAddon *instanciate_themes_addon() -{ - return NULL; -} +#define DEBUG_TA +#ifdef DEBUG_TA +#define FENTRY PRINT(("*ThemesAddon[%s]::%s()\n", Name(), __FUNCTION__)) +#else +#define FENTRY +#endif -#if 0 // DANO... +#define DERR(e) { PRINT(("%s: err: %s\n", __FUNCTION__, strerror(e))); } -//#define A_NAME "UI Settings" +// private font API +extern void _set_system_font_(const char *which, font_family family, + font_style style, float size); +extern status_t _get_system_default_font_(const char* which, + font_family family, font_style style, float* _size); + + #define A_NAME "System Colors and Fonts" #define A_MSGNAME Z_THEME_UI_SETTINGS #define A_DESCRIPTION "System colors, fonts and other goodies" @@ -53,13 +62,45 @@ status_t ApplyDefaultTheme(uint32 flags=0L); }; +struct ui_color_map { + const char *name; + color_which id; +} gUIColorMap[] = { + { B_UI_PANEL_BACKGROUND_COLOR, B_PANEL_BACKGROUND_COLOR }, + { B_UI_PANEL_TEXT_COLOR, B_PANEL_TEXT_COLOR }, +// { B_UI_PANEL_LINK_COLOR, B_PANEL_LINK_COLOR }, + { B_UI_DOCUMENT_BACKGROUND_COLOR, B_DOCUMENT_BACKGROUND_COLOR }, + { B_UI_DOCUMENT_TEXT_COLOR, B_DOCUMENT_TEXT_COLOR }, +// { B_UI_DOCUMENT_LINK_COLOR, B_DOCUMENT_LINK_COLOR }, + { B_UI_CONTROL_BACKGROUND_COLOR, B_CONTROL_BACKGROUND_COLOR }, + { B_UI_CONTROL_TEXT_COLOR, B_CONTROL_TEXT_COLOR }, + { B_UI_CONTROL_BORDER_COLOR, B_CONTROL_BORDER_COLOR }, + { B_UI_CONTROL_HIGHLIGHT_COLOR, B_CONTROL_HIGHLIGHT_COLOR }, + { B_UI_NAVIGATION_BASE_COLOR, B_NAVIGATION_BASE_COLOR }, + { B_UI_NAVIGATION_PULSE_COLOR, B_NAVIGATION_PULSE_COLOR }, + { B_UI_SHINE_COLOR, B_SHINE_COLOR }, + { B_UI_SHADOW_COLOR, B_SHADOW_COLOR }, + { B_UI_TOOLTIP_BACKGROUND_COLOR, B_TOOLTIP_BACKGROUND_COLOR }, + { B_UI_TOOLTIP_TEXT_COLOR, B_TOOLTIP_TEXT_COLOR }, + { B_UI_MENU_BACKGROUND_COLOR, B_MENU_BACKGROUND_COLOR }, + { B_UI_MENU_SELECTED_BACKGROUND_COLOR, B_MENU_SELECTED_BACKGROUND_COLOR }, + { B_UI_MENU_ITEM_TEXT_COLOR, B_MENU_ITEM_TEXT_COLOR }, + { B_UI_MENU_SELECTED_ITEM_TEXT_COLOR, B_MENU_SELECTED_ITEM_TEXT_COLOR }, + { B_UI_MENU_SELECTED_BORDER_COLOR, B_MENU_SELECTED_BORDER_COLOR }, + { B_UI_SUCCESS_COLOR, B_SUCCESS_COLOR }, + { B_UI_FAILURE_COLOR, B_FAILURE_COLOR }, + { NULL, (color_which)-1 } +}; + UISettingsThemesAddon::UISettingsThemesAddon() : ThemesAddon(A_NAME, A_MSGNAME) { + FENTRY; } UISettingsThemesAddon::~UISettingsThemesAddon() { + FENTRY; } const char *UISettingsThemesAddon::Description() @@ -72,6 +113,7 @@ status_t err = B_OK; entry_ref ref; BEntry ent; + FENTRY; /* err = ent.SetTo("/boot/beos/preferences/Colors"); if (!err) { @@ -83,16 +125,11 @@ */ if (!err) return B_OK; - err = ent.SetTo("/system/add-ons/Preferences/Appearance"); + err = ent.SetTo("/boot/beos/preferences/Appearance"); if (!err) { err = ent.GetRef(&ref); if (!err) { err = be_roster->Launch(&ref); - if (err) { - BMessage msg(B_REFS_RECEIVED); - msg.AddRef("refs", &ref); - be_app_messenger.SendMessage(&msg); - } } } return err; @@ -100,24 +137,45 @@ status_t UISettingsThemesAddon::AddNames(BMessage &names) { - BMessage uisettings; - BMessage uinames; - status_t err; const char *str, *value; type_code code; int32 i; + FENTRY; - err = get_ui_settings(&uisettings, &uinames); - if (err) - return err; names.AddString(Z_THEME_UI_SETTINGS, "UI Settings"); - // hack for legacy fonts + // Haiku doesn't know about them, wo add them + //XXX: use symbolic names. + names.AddString("be:c:PanBg", "Panel Background"); + names.AddString("be:c:PanTx", "Panel Text"); + names.AddString("be:c:PanLn", "Panel Link"); + names.AddString("be:c:DocBg", "Document Background"); + names.AddString("be:c:DocTx", "Document Text"); + names.AddString("be:c:DocLn", "Document Link"); + names.AddString("be:c:CtlBg", "Control Background"); + names.AddString("be:c:CtlTx", "Control Text"); + names.AddString("be:c:CtlBr", "Control Border"); + names.AddString("be:c:CtlHg", "Control Highlight"); + names.AddString("be:c:NavBs", "Navigation Base"); + names.AddString("be:c:NavPl", "Navigation Pulse"); + names.AddString("be:c:Shine", "Shine"); + names.AddString("be:c:Shadow", "Shadow"); + names.AddString("be:c:TipBg", "ToolTip Background"); + names.AddString("be:c:TipTx", "ToolTip Text"); + names.AddString("be:c:MenBg", "Menu Background"); + names.AddString("be:c:MenSBg", "Menu Selected Background"); + names.AddString("be:c:MenTx", "Menu Item Text"); + names.AddString("be:c:MenSTx", "Menu Selected Item Text"); + names.AddString("be:c:MenSBr", "Menu Selected Border"); + names.AddString("be:c:Success", "Success"); + names.AddString("be:c:Failure", "Failure"); + names.AddString("be:f:MenTx", "Menu Item Text"); + names.AddString("be:MenSep", "Menu Separator"); + names.AddString("be:MenTrig", "Show Menu Triggers"); + names.AddString("be:MenZSnake", "Menu ZSnake"); + names.AddString("be:f:Tip", "ToolTip"); names.AddString("be:f:be_plain_font", "System Plain"); names.AddString("be:f:be_bold_font", "System Bold"); names.AddString("be:f:be_fixed_font", "System Fixed"); - for (i = 0; uinames.GetInfo(B_STRING_TYPE, i, &str, &code) == B_OK;i++) - if (uinames.FindString(str, &value) == B_OK) - names.AddString(str, value); return B_OK; } @@ -126,32 +184,52 @@ BMessage uisettings; BFont fnt; status_t err; + int i; + FENTRY; (void)flags; err = MyMessage(theme, uisettings); + DERR(err); if (err) return err; - // hack for legacy fonts - err = uisettings.FindFlat("be:f:be_plain_font", &fnt); + font_family family; + font_style style; + + err = FindFont(uisettings, "be:f:be_plain_font", 0, &fnt); uisettings.RemoveName("be:f:be_plain_font"); - if (err == B_OK) - BFont::SetStandardFont(B_PLAIN_FONT, &fnt); + DERR(err); + if (err == B_OK) { + fnt.GetFamilyAndStyle(&family, &style); + _set_system_font_("plain", family, style, fnt.Size()); + } - err = uisettings.FindFlat("be:f:be_bold_font", &fnt); + err = FindFont(uisettings, "be:f:be_bold_font", 0, &fnt); + DERR(err); uisettings.RemoveName("be:f:be_bold_font"); - if (err == B_OK) - BFont::SetStandardFont(B_BOLD_FONT, &fnt); + if (err == B_OK) { + fnt.GetFamilyAndStyle(&family, &style); + _set_system_font_("bold", family, style, fnt.Size()); + } - err = uisettings.FindFlat("be:f:be_fixed_font", &fnt); + err = FindFont(uisettings, "be:f:be_fixed_font", 0, &fnt); + DERR(err); uisettings.RemoveName("be:f:be_fixed_font"); - if (err == B_OK) - BFont::SetStandardFont(B_FIXED_FONT, &fnt); + if (err == B_OK) { + fnt.GetFamilyAndStyle(&family, &style); + _set_system_font_("fixed", family, style, fnt.Size()); + } + for (i = 0; gUIColorMap[i].name; i++) { + rgb_color c; + if (FindRGBColor(uisettings, gUIColorMap[i].name, 0, &c) == B_OK) { + set_ui_color(gUIColorMap[i].id, c); + fprintf(stderr, "set_ui_color(%d, #%02x%02x%02x)\n", + gUIColorMap[i].id, c.red, c.green, c.blue); + } + } - update_ui_settings(uisettings); - return B_OK; } @@ -161,23 +239,23 @@ BMessage names; BFont fnt; status_t err; + int i; + FENTRY; (void)flags; err = MyMessage(theme, uisettings); if (err) uisettings.MakeEmpty(); - err = get_ui_settings(&uisettings, &names); - if (err) - return err; + for (i = 0; gUIColorMap[i].name; i++) { + rgb_color c = ui_color(gUIColorMap[i].id); + AddRGBColor(uisettings, gUIColorMap[i].name, c); + } // hack for legacy fonts - err = BFont::GetStandardFont(B_PLAIN_FONT, &fnt); - uisettings.AddFlat("be:f:be_plain_font", &fnt); - err = BFont::GetStandardFont(B_BOLD_FONT, &fnt); - uisettings.AddFlat("be:f:be_bold_font", &fnt); - err = BFont::GetStandardFont(B_FIXED_FONT, &fnt); - uisettings.AddFlat("be:f:be_fixed_font", &fnt); + AddFont(uisettings, "be:f:be_plain_font", (BFont *)be_plain_font); + AddFont(uisettings, "be:f:be_bold_font", (BFont *)be_bold_font); + AddFont(uisettings, "be:f:be_fixed_font", (BFont *)be_fixed_font); err = SetMyMessage(theme, uisettings); return err; @@ -189,19 +267,36 @@ BMessage uisettings; BFont fnt; status_t err; + FENTRY; + /* err = get_default_settings(&uisettings); if (err) return err; - - // hack for legacy fonts - err = BFont::GetStandardFont((font_which)(B_PLAIN_FONT-100), &fnt); - uisettings.AddFlat("be:f:be_plain_font", &fnt); - err = BFont::GetStandardFont((font_which)(B_BOLD_FONT-100), &fnt); - uisettings.AddFlat("be:f:be_bold_font", &fnt); - err = BFont::GetStandardFont((font_which)(B_FIXED_FONT-100), &fnt); - uisettings.AddFlat("be:f:be_fixed_font", &fnt); + */ + font_family family; + font_style style; + float size; + BFont f; + if (_get_system_default_font_("plain", family, style, &size) != B_OK) + return B_ERROR; + f.SetFamilyAndStyle(family, style); + f.SetSize(size); + AddFont(uisettings, "be:f:be_plain_font", &f); + + if (_get_system_default_font_(Name(), family, style, &size) != B_OK) + return B_ERROR; + f.SetFamilyAndStyle(family, style); + f.SetSize(size); + AddFont(uisettings, "be:f:be_plain_font", &f); + + if (_get_system_default_font_(Name(), family, style, &size) != B_OK) + return B_ERROR; + f.SetFamilyAndStyle(family, style); + f.SetSize(size); + AddFont(uisettings, "be:f:be_plain_font", &f); + theme.AddMessage(A_MSGNAME, &uisettings); return ApplyTheme(theme, flags); } @@ -212,6 +307,4 @@ return (ThemesAddon *) new UISettingsThemesAddon; } -#endif - -#endif /* B_BEOS_VERSION_DANO */ \ No newline at end of file +#endif /* B_BEOS_VERSION_DANO */ Modified: haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp 2008-01-14 01:58:51 UTC (rev 23507) +++ haiku/trunk/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp 2008-01-14 02:00:42 UTC (rev 23508) @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -27,14 +28,37 @@ #define instanciate_themes_addon instanciate_themes_addon_window_decor #endif -//XXX: FIXME -ThemesAddon *instanciate_themes_addon() +#define DERR(e) { PRINT(("%s: err: %s\n", __FUNCTION__, strerror(e))); } + +namespace BPrivate { +int32 count_decorators(void); +int32 get_decorator(void); +status_t get_decorator_name(const int32 &index, BString &name); +status_t get_decorator_preview(const int32 &index, BBitmap *bitmap); +status_t set_decorator(const int32 &index); +} + +using namespace BPrivate; + +status_t set_decorator(const char *name) { - return NULL; + BString n; + status_t err; + int i = count_decorators() - 1; + for (; i > -1; i--) { + err = get_decorator_name(i, n); + DERR(err); + if (err < B_OK) + continue; + if (n == name) { + err = set_decorator(i); + DERR(err); + return err; + } + } + return ENOENT; } -#if 0 // DANO... - #define A_NAME "Window Decor" #define A_MSGNAME Z_THEME_WINDOW_DECORATIONS #define A_DESCRIPTION "Window decorations and scrollbars" @@ -75,16 +99,11 @@ status_t err; entry_ref ref; BEntry ent; - err = ent.SetTo("/system/add-ons/Preferences/Appearance"); + err = ent.SetTo("/boot/beos/references/Appearance"); if (!err) { err = ent.GetRef(&ref); if (!err) { err = be_roster->Launch(&ref); - if (err) { - BMessage msg(B_REFS_RECEIVED); - msg.AddRef("refs", &ref); - be_app_messenger.SendMessage(&msg); - } } } return err; @@ -107,9 +126,13 @@ (void)flags; err = MyMessage(theme, window_decor); + DERR(err); if (err) return err; - + + if (window_decor.FindString("window:decor", &decorName) == B_OK) + set_decorator(decorName.String()); +#if 0 #ifdef B_BEOS_VERSION_DANO if (window_decor.FindString("window:decor", &decorName) == B_OK) set_window_decor(decorName.String(), @@ -120,6 +143,7 @@ if (window_decor.FindInt32("window:R5:decor", &decorNr) == B_OK) __set_window_decor(decorNr); #endif +#endif // XXX: add colors ? la WindowShade ? return B_OK; @@ -134,11 +158,20 @@ (void)flags; err = MyMessage(theme, window_decor); + DERR(err); if (err) window_decor.MakeEmpty(); - + + err = get_decorator_name(get_decorator(), decorName); + DERR(err); + if (err == B_OK) { + window_decor.AddString("window:decor", decorName.String()); + window_decor.AddMessage("window:decor_globals", &globals); + } +#if 0 #ifdef B_BEOS_VERSION_DANO err = get_window_decor(&decorName, &globals); + DERR(err); if (err == B_OK) { window_decor.AddString("window:decor", decorName.String()); window_decor.AddMessage("window:decor_globals", &globals); @@ -146,8 +179,10 @@ #else window_decor.AddInt32("window:R5:decor", 0); #endif +#endif err = SetMyMessage(theme, window_decor); + DERR(err); return err; } @@ -167,6 +202,4 @@ return (ThemesAddon *) new DecorThemesAddon; } -#endif - #endif /* B_BEOS_VERSION_DANO */ From mmu_man at mail.berlios.de Mon Jan 14 03:03:35 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Mon, 14 Jan 2008 03:03:35 +0100 Subject: [Haiku-commits] r23509 - in haiku/trunk: headers/private/libroot src/system/libroot src/system/libroot/posix Message-ID: <200801140203.m0E23Zi0025261@sheep.berlios.de> Author: mmu_man Date: 2008-01-14 03:03:34 +0100 (Mon, 14 Jan 2008) New Revision: 23509 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23509&view=rev Modified: haiku/trunk/headers/private/libroot/libroot_private.h haiku/trunk/src/system/libroot/libroot_init.c haiku/trunk/src/system/libroot/posix/pwd.c haiku/trunk/src/system/libroot/posix/pwd_query.c Log: Works much better when actually allocating the TLS entry... Now the backend works, Login can list users. Modified: haiku/trunk/headers/private/libroot/libroot_private.h =================================================================== --- haiku/trunk/headers/private/libroot/libroot_private.h 2008-01-14 02:00:42 UTC (rev 23508) +++ haiku/trunk/headers/private/libroot/libroot_private.h 2008-01-14 02:03:34 UTC (rev 23509) @@ -32,6 +32,7 @@ void __init_time(void); void __arch_init_time(struct real_time_data *data, bool setDefaults); bigtime_t __arch_get_system_time_offset(struct real_time_data *data); +void __init_pwd_backend(void); #ifdef __cplusplus } Modified: haiku/trunk/src/system/libroot/libroot_init.c =================================================================== --- haiku/trunk/src/system/libroot/libroot_init.c 2008-01-14 02:00:42 UTC (rev 23508) +++ haiku/trunk/src/system/libroot/libroot_init.c 2008-01-14 02:03:34 UTC (rev 23509) @@ -58,6 +58,7 @@ __init_fork(); __init_heap(); __init_env(__gRuntimeLoader->program_args); + __init_pwd_backend(); } Modified: haiku/trunk/src/system/libroot/posix/pwd.c =================================================================== --- haiku/trunk/src/system/libroot/posix/pwd.c 2008-01-14 02:00:42 UTC (rev 23508) +++ haiku/trunk/src/system/libroot/posix/pwd.c 2008-01-14 02:03:34 UTC (rev 23509) @@ -133,3 +133,7 @@ return 0; } +void __init_pwd_backend(void) +{ +} + Modified: haiku/trunk/src/system/libroot/posix/pwd_query.c =================================================================== --- haiku/trunk/src/system/libroot/posix/pwd_query.c 2008-01-14 02:00:42 UTC (rev 23508) +++ haiku/trunk/src/system/libroot/posix/pwd_query.c 2008-01-14 02:03:34 UTC (rev 23509) @@ -620,9 +620,7 @@ } - -void __init_pwd_stuff(void) -//void _multiuser_init(void) +void __init_pwd_backend(void) { /* dev_t for the boot volume */ boot_device = dev_for_path("/boot"); @@ -630,12 +628,12 @@ pw_tls_id = tls_allocate(); } -void __fini_pwd_stuff(void) -//void _multiuser_fini(void) +/* +void __fini_pwd_backend(void) { } +*/ - #endif /* REAL_MULTIUSER */ From mmu_man at mail.berlios.de Mon Jan 14 03:04:43 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Mon, 14 Jan 2008 03:04:43 +0100 Subject: [Haiku-commits] r23510 - haiku/trunk/src/apps/codycam Message-ID: <200801140204.m0E24hHD025341@sheep.berlios.de> Author: mmu_man Date: 2008-01-14 03:04:42 +0100 (Mon, 14 Jan 2008) New Revision: 23510 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23510&view=rev Modified: haiku/trunk/src/apps/codycam/SftpClient.cpp Log: * Match [Pp]assword: * Handle failing to remove the old image in case it's not there. Modified: haiku/trunk/src/apps/codycam/SftpClient.cpp =================================================================== --- haiku/trunk/src/apps/codycam/SftpClient.cpp 2008-01-14 02:03:34 UTC (rev 23509) +++ haiku/trunk/src/apps/codycam/SftpClient.cpp 2008-01-14 02:04:42 UTC (rev 23510) @@ -93,7 +93,7 @@ return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); - if (reply.FindFirst("password:") < 0) + if (reply.FindFirst(/*[pP]*/"assword:") < 0) return false; write(OutputPipe(), passwd.c_str(), strlen(passwd.c_str())); @@ -170,6 +170,7 @@ // sftpd can't rename to an existing file... BString cmd("rm"); cmd << " " << newPath.c_str() << "\n"; + fprintf(stderr, "CMD: '%s'\n", cmd.String()); SendCommand(cmd.String()); BString reply; @@ -178,8 +179,9 @@ return false; } fprintf(stderr, "reply: '%s'\n", reply.String()); - if (reply.FindFirst("Removing") != 0) - return false; + // we don't care if it worked or not. + //if (reply.FindFirst("Removing") != 0 && reply.FindFirst("Couldn't") ) + // return false; if ((len = ReadReply(&reply)) < 0) { fprintf(stderr, "read: %d\n", len); From stefano.ceccherini at gmail.com Mon Jan 14 09:11:15 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Mon, 14 Jan 2008 09:11:15 +0100 Subject: [Haiku-commits] r23424 - haiku/trunk/src/kits/interface In-Reply-To: <200801112312.m0BNCgHX000132@sheep.berlios.de> References: <200801112312.m0BNCgHX000132@sheep.berlios.de> Message-ID: <894b9700801140011m11acbcafhd0475b62647e10db@mail.gmail.com> 2008/1/12, mmlr at BerliOS : > Author: mmlr > Date: 2008-01-12 00:12:41 +0100 (Sat, 12 Jan 2008) > New Revision: 23424 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23424&view=rev > > Modified: > haiku/trunk/src/kits/interface/View.cpp > Log: > Add a temporary backwards compatibility fix for applications that accidently > mix up the resizingMode and flags field in the BView constructor. This does > not cause problems under BeOS but was causing wrong follow modes when those > applications were run under Haiku. In case such an application is detetected > a corresponding warning is printed out. Also added a comment explaining the > rational behind the change and a ToDo for the later cleanup. > > Modified: haiku/trunk/src/kits/interface/View.cpp > > - // initialize members > - fFlags = (resizingMode & _RESIZE_MASK_) | (flags & ~_RESIZE_MASK_); > + // initialize members > + if ((resizingMode & ~_RESIZE_MASK_) || (flags & _RESIZE_MASK_)) > + printf("BView::InitData(): resizing mode or flags swapped\n"); > > + // There are applications that swap the resize mask and the flags in the > + // BView constructor. This does not cause problems under BeOS as it just > + // ors the two fields to one 32bit flag. > + // For now we do the same but print the above warning message. > + // ToDo: this should be removed at some point and the original > + // version restored: > + // fFlags = (resizingMode & _RESIZE_MASK_) | (flags & ~_RESIZE_MASK_); > + fFlags = resizingMode | flags; > + Shouldn't this be changed also in BView::SetFlags() ? From ingo_weinhold at gmx.de Mon Jan 14 10:38:41 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 14 Jan 2008 10:38:41 +0100 Subject: [Haiku-commits] r23509 - in haiku/trunk: headers/private/libroot src/system/libroot src/system/libroot/posix In-Reply-To: <200801140203.m0E23Zi0025261@sheep.berlios.de> References: <200801140203.m0E23Zi0025261@sheep.berlios.de> Message-ID: <20080114103841.458.2@knochen-vm.nameserver> On 2008-01-14 at 03:03:35 [+0100], mmu_man at BerliOS wrote: > Author: mmu_man > Date: 2008-01-14 03:03:34 +0100 (Mon, 14 Jan 2008) > New Revision: 23509 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23509&view=rev [...] > Modified: haiku/trunk/src/system/libroot/posix/pwd.c > =================================================================== > --- haiku/trunk/src/system/libroot/posix/pwd.c 2008-01-14 02:00:42 UTC > (rev 23508) > +++ haiku/trunk/src/system/libroot/posix/pwd.c 2008-01-14 02:03:34 UTC > (rev 23509) > @@ -133,3 +133,7 @@ > return 0; > } > > +void __init_pwd_backend(void) > +{ > +} > + The Haiku Style Police has detected a violation of the style guide. Be warned! Upon repeated violations the case will be submitted to the Haiku Style Court, and you will face a sentence of buying large quantities of beer for the other developers at the next BeGeistert. Yours sincerly, Ingo Weinhold Secretary to Chief Style DA Axel D?rfler From bonefish at mail.berlios.de Mon Jan 14 10:50:33 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 14 Jan 2008 10:50:33 +0100 Subject: [Haiku-commits] r23511 - haiku/trunk/src/system/kernel/debug Message-ID: <200801140950.m0E9oXDc003104@sheep.berlios.de> Author: bonefish Date: 2008-01-14 10:50:32 +0100 (Mon, 14 Jan 2008) New Revision: 23511 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23511&view=rev Added: haiku/trunk/src/system/kernel/debug/debug.cpp Removed: haiku/trunk/src/system/kernel/debug/debug.c Modified: haiku/trunk/src/system/kernel/debug/Jamfile haiku/trunk/src/system/kernel/debug/gdb.h Log: debug.c -> debug.cpp Modified: haiku/trunk/src/system/kernel/debug/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/debug/Jamfile 2008-01-14 02:04:42 UTC (rev 23510) +++ haiku/trunk/src/system/kernel/debug/Jamfile 2008-01-14 09:50:32 UTC (rev 23511) @@ -4,7 +4,7 @@ KernelMergeObject kernel_debug.o : blue_screen.cpp - debug.c + debug.cpp frame_buffer_console.cpp gdb.c tracing.cpp Deleted: haiku/trunk/src/system/kernel/debug/debug.c Copied: haiku/trunk/src/system/kernel/debug/debug.cpp (from rev 23510, haiku/trunk/src/system/kernel/debug/debug.c) =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.c 2008-01-14 02:04:42 UTC (rev 23510) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2008-01-14 09:50:32 UTC (rev 23511) @@ -0,0 +1,1134 @@ +/* + * Copyright 2002-2007, Axel D?rfler, axeld at pinc-software.de + * Distributed under the terms of the MIT License. + * + * Copyright 2001, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ + +/*! This file contains the debugger and debug output facilities */ + +#include "blue_screen.h" +#include "gdb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + + +int kgets(char *buffer, int length); + +typedef struct debugger_command { + struct debugger_command *next; + int (*func)(int, char **); + const char *name; + const char *description; +} debugger_command; + +int dbg_register_file[B_MAX_CPU_COUNT][14]; + /* XXXmpetit -- must be made generic */ + +static bool sSerialDebugEnabled = true; +static bool sSyslogOutputEnabled = true; +static bool sBlueScreenEnabled = false; + // must always be false on startup +static bool sDebugScreenEnabled = false; +static bool sBlueScreenOutput = true; +static spinlock sSpinlock = 0; +static int32 sDebuggerOnCPU = -1; + +static sem_id sSyslogNotify = -1; +static struct syslog_message *sSyslogMessage; +static struct ring_buffer *sSyslogBuffer; +static bool sSyslogDropped = false; + +static struct debugger_command *sCommands; + +static jmp_buf sInvokeCommandEnv; +static bool sInvokeCommandDirectly = false; + +#define SYSLOG_BUFFER_SIZE 65536 +#define OUTPUT_BUFFER_SIZE 1024 +static char sOutputBuffer[OUTPUT_BUFFER_SIZE]; +static char sLastOutputBuffer[OUTPUT_BUFFER_SIZE]; + +static void flush_pending_repeats(void); +static void check_pending_repeats(void *data, int iter); + +static int64 sMessageRepeatFirstTime = 0; +static int64 sMessageRepeatLastTime = 0; +static int32 sMessageRepeatCount = 0; + +#define LINE_BUFFER_SIZE 1024 +#define MAX_ARGS 16 +#define HISTORY_SIZE 16 + +static char sLineBuffer[HISTORY_SIZE][LINE_BUFFER_SIZE] = { "", }; +static char sParseLine[LINE_BUFFER_SIZE]; +static int32 sCurrentLine = 0; +static char *sArguments[MAX_ARGS] = { NULL, }; + +#define distance(a, b) ((a) < (b) ? (b) - (a) : (a) - (b)) + + +static debugger_command * +find_command(char *name, bool partialMatch) +{ + debugger_command *command; + int length; + + // search command by full name + + for (command = sCommands; command != NULL; command = command->next) { + if (strcmp(name, command->name) == 0) + return command; + } + + // if it couldn't be found, search for a partial match + + if (partialMatch) { + length = strlen(name); + if (length == 0) + return NULL; + + for (command = sCommands; command != NULL; command = command->next) { + if (strncmp(name, command->name, length) == 0) + return command; + } + } + + return NULL; +} + + +static void +kputchar(char c) +{ + if (sSerialDebugEnabled) + arch_debug_serial_putchar(c); + if (sBlueScreenEnabled || sDebugScreenEnabled) + blue_screen_putchar(c); +} + + +static void +kputs(const char *s) +{ + if (sSerialDebugEnabled) + arch_debug_serial_puts(s); + if (sBlueScreenEnabled || sDebugScreenEnabled) + blue_screen_puts(s); +} + + +static int +read_line(char *buffer, int32 maxLength) +{ + int32 currentHistoryLine = sCurrentLine; + int32 position = 0; + bool done = false; + char c; + + char (*readChar)(void); + if (sBlueScreenOutput) + readChar = blue_screen_getchar; + else + readChar = arch_debug_serial_getchar; + + while (!done) { + c = readChar(); + + switch (c) { + case '\n': + case '\r': + buffer[position++] = '\0'; + kputchar('\n'); + done = true; + break; + case 8: // backspace + if (position > 0) { + kputs("\x1b[1D"); // move to the left one + kputchar(' '); + kputs("\x1b[1D"); // move to the left one + position--; + } + break; + case 27: // escape sequence + c = readChar(); + if (c != '[') { + // ignore broken escape sequence + break; + } + c = readChar(); + switch (c) { + case 'C': // right arrow acts like space + buffer[position++] = ' '; + kputchar(' '); + break; + case 'D': // left arrow acts like backspace + if (position > 0) { + kputs("\x1b[1D"); // move to the left one + kputchar(' '); + kputs("\x1b[1D"); // move to the left one + position--; + } + break; + case 'A': // up arrow + case 'B': // down arrow + { + int32 historyLine = 0; + + if (c == 65) { + // up arrow + historyLine = currentHistoryLine - 1; + if (historyLine < 0) + historyLine = HISTORY_SIZE - 1; + } else { + // down arrow + if (currentHistoryLine == sCurrentLine) + break; + + historyLine = currentHistoryLine + 1; + if (historyLine >= HISTORY_SIZE) + historyLine = 0; + } + + // clear the history again if we're in the current line again + // (the buffer we get just is the current line buffer) + if (historyLine == sCurrentLine) + sLineBuffer[historyLine][0] = '\0'; + + // swap the current line with something from the history + if (position > 0) + kprintf("\x1b[%ldD", position); // move to beginning of line + + strcpy(buffer, sLineBuffer[historyLine]); + position = strlen(buffer); + kprintf("%s\x1b[K", buffer); // print the line and clear the rest + currentHistoryLine = historyLine; + break; + } + default: + break; + } + break; + case '$': + case '+': + if (!sBlueScreenOutput) { + /* HACK ALERT!!! + * + * If we get a $ at the beginning of the line + * we assume we are talking with GDB + */ + if (position == 0) { + strcpy(buffer, "gdb"); + position = 4; + done = true; + break; + } + } + /* supposed to fall through */ + default: + if (isprint(c)) { + buffer[position++] = c; + kputchar(c); + } + break; + } + + if (position >= maxLength - 2) { + buffer[position++] = '\0'; + kputchar('\n'); + done = true; + break; + } + } + + return position; +} + + +int +kgets(char *buffer, int length) +{ + return read_line(buffer, length); +} + + +static int +parse_line(const char *buffer, char **argv, int *_argc, int32 maxArgs) +{ + char *string = sParseLine; + int32 index = 0; + + strcpy(string, buffer); + + for (; index < maxArgs && string[0]; index++) { + char quoted; + char c; + + // skip white space + while ((c = string[0]) != '\0' && isspace(c)) { + string++; + } + if (!c) + break; + + if (c == '\'' || c == '"') { + argv[index] = ++string; + quoted = c; + } else { + argv[index] = string; + quoted = 0; + } + + // find end of string + + while (string[0] + && ((quoted && string[0] != quoted) + || (!quoted && !isspace(string[0])))) { + if (string[0] == '\\') { + // filter out backslashes + strcpy(string, string + 1); + string++; + } + string++; + } + + if (string[0]) { + // terminate string + string[0] = '\0'; + string++; + } + } + + return *_argc = index; +} + + +/*! This function is a safe gate through which debugger commands are invoked. + It sets a fault handler before invoking the command, so that an invalid + memory access will not result in another KDL session on top of this one + (and "cont" not to work anymore). We use setjmp() + longjmp() to "unwind" + the stack after catching a fault. + */ +static int +invoke_command(struct debugger_command *command, int argc, char** argv) +{ + struct thread* thread = thread_get_current_thread(); + addr_t oldFaultHandler = thread->fault_handler; + + // replace argv[0] with the actual command name + argv[0] = (char *)command->name; + + // Invoking the command directly might be useful when debugging debugger + // commands. + if (sInvokeCommandDirectly) + return command->func(argc, argv); + + if (setjmp(sInvokeCommandEnv) == 0) { + int result; + thread->fault_handler = (addr_t)&&error; + // Fake goto to trick the compiler not to optimize the code at the label + // away. + if (!thread) + goto error; + + result = command->func(argc, argv); + thread->fault_handler = oldFaultHandler; + return result; + +error: + longjmp(sInvokeCommandEnv, 1); + // jump into the else branch + } else { + kprintf("\n[*** READ/WRITE FAULT ***]\n"); + } + + thread->fault_handler = oldFaultHandler; + return 0; +} + + +static void +kernel_debugger_loop(void) +{ + int32 previousCPU = sDebuggerOnCPU; + sDebuggerOnCPU = smp_get_current_cpu(); + + kprintf("Welcome to Kernel Debugging Land...\n"); + kprintf("Running on CPU %ld\n", sDebuggerOnCPU); + + for (;;) { + struct debugger_command *cmd = NULL; + int argc; + + kprintf("kdebug> "); + read_line(sLineBuffer[sCurrentLine], LINE_BUFFER_SIZE); + parse_line(sLineBuffer[sCurrentLine], sArguments, &argc, MAX_ARGS); + + // We support calling last executed command again if + // B_KDEDUG_CONT was returned last time, so cmd != NULL + if (argc <= 0 && cmd == NULL) + continue; + + sDebuggerOnCPU = smp_get_current_cpu(); + + if (argc > 0) + cmd = find_command(sArguments[0], true); + + if (cmd == NULL) + kprintf("unknown command, enter \"help\" to get a list of all supported commands\n"); + else { + int rc = invoke_command(cmd, argc, sArguments); + + if (rc == B_KDEBUG_QUIT) + break; // okay, exit now. + + if (rc != B_KDEBUG_CONT) + cmd = NULL; // forget last command executed... + } + + if (++sCurrentLine >= HISTORY_SIZE) + sCurrentLine = 0; + } + + sDebuggerOnCPU = previousCPU; +} + + +static int +cmd_reboot(int argc, char **argv) +{ + arch_cpu_shutdown(true); + return 0; + // I'll be really suprised if this line ever runs! ;-) +} + + +static int +cmd_shutdown(int argc, char **argv) +{ + arch_cpu_shutdown(false); + return 0; +} + + +static int +cmd_help(int argc, char **argv) +{ + debugger_command *command, *specified = NULL; + const char *start = NULL; + int32 startLength = 0; + + if (argc > 1) { + specified = find_command(argv[1], false); + if (specified == NULL) { + start = argv[1]; + startLength = strlen(start); + } + } + + if (specified != NULL) { + // only print out the help of the specified command (and all of its aliases) + kprintf("debugger command for \"%s\" and aliases:\n", specified->name); + } else if (start != NULL) + kprintf("debugger commands starting with \"%s\":\n", start); + else + kprintf("debugger commands:\n"); + + for (command = sCommands; command != NULL; command = command->next) { + if (specified && command->func != specified->func) + continue; + if (start != NULL && strncmp(start, command->name, startLength)) + continue; + + kprintf(" %-20s\t\t%s\n", command->name, command->description ? command->description : "-"); + } + + return 0; +} + + +static int +cmd_continue(int argc, char **argv) +{ + return B_KDEBUG_QUIT; +} + + +static status_t +syslog_sender(void *data) +{ + status_t error = B_BAD_PORT_ID; + port_id port = -1; + bool bufferPending = false; + int32 length = 0; + + while (true) { + // wait for syslog data to become available + acquire_sem(sSyslogNotify); + + sSyslogMessage->when = real_time_clock(); + + if (error == B_BAD_PORT_ID) { + // last message couldn't be sent, try to locate the syslog_daemon + port = find_port(SYSLOG_PORT_NAME); + } + + if (port >= B_OK) { + if (!bufferPending) { + // we need to have exclusive access to our syslog buffer + cpu_status state = disable_interrupts(); + acquire_spinlock(&sSpinlock); + + length = ring_buffer_readable(sSyslogBuffer); + if (length > (int32)SYSLOG_MAX_MESSAGE_LENGTH) + length = SYSLOG_MAX_MESSAGE_LENGTH; + + length = ring_buffer_read(sSyslogBuffer, + (uint8 *)sSyslogMessage->message, length); + if (sSyslogDropped) { + // add drop marker + if (length < (int32)SYSLOG_MAX_MESSAGE_LENGTH - 6) + strlcat(sSyslogMessage->message, "", SYSLOG_MAX_MESSAGE_LENGTH); + else if (length > 7) + strcpy(sSyslogMessage->message + length - 7, ""); + + sSyslogDropped = false; + } + + release_spinlock(&sSpinlock); + restore_interrupts(state); + } + + if (length == 0) { + // the buffer we came here for might have been sent already + bufferPending = false; + continue; + } + + error = write_port_etc(port, SYSLOG_MESSAGE, sSyslogMessage, + sizeof(struct syslog_message) + length, B_RELATIVE_TIMEOUT, 0); + + if (error < B_OK) { + // sending has failed - just wait, maybe it'll work later. + bufferPending = true; + continue; + } + + if (bufferPending) { + // we could write the last pending buffer, try to read more + // from the syslog ring buffer + release_sem_etc(sSyslogNotify, 1, B_DO_NOT_RESCHEDULE); + bufferPending = false; + } + } + } + + return 0; +} + + +static void +syslog_write(const char *text, int32 length) +{ + bool trunc = false; + + if (sSyslogBuffer == NULL) + return; + + if ((int32)ring_buffer_writable(sSyslogBuffer) < length) { + // truncate data + length = ring_buffer_writable(sSyslogBuffer); + + if (length > 8) { + trunc = true; + length -= 8; + } else + sSyslogDropped = true; + } + + ring_buffer_write(sSyslogBuffer, (uint8 *)text, length); + if (trunc) + ring_buffer_write(sSyslogBuffer, (uint8 *)"", 7); + + release_sem_etc(sSyslogNotify, 1, B_DO_NOT_RESCHEDULE); +} + + +static status_t +syslog_init_post_threads(void) +{ + if (!sSyslogOutputEnabled) + return B_OK; + + sSyslogNotify = create_sem(0, "syslog data"); + if (sSyslogNotify >= B_OK) { + thread_id thread = spawn_kernel_thread(syslog_sender, "syslog sender", + B_LOW_PRIORITY, NULL); + if (thread >= B_OK && resume_thread(thread) == B_OK) + return B_OK; + } + + // initializing kernel syslog service failed -- disable it + + sSyslogOutputEnabled = false; + free(sSyslogMessage); + free(sSyslogBuffer); + delete_sem(sSyslogNotify); + + return B_ERROR; +} + + +static status_t +syslog_init(struct kernel_args *args) +{ + status_t status; + + if (!sSyslogOutputEnabled) + return B_OK; + + sSyslogMessage = (syslog_message*)malloc(SYSLOG_MESSAGE_BUFFER_SIZE); + if (sSyslogMessage == NULL) { + status = B_NO_MEMORY; + goto err1; + } + + sSyslogBuffer = create_ring_buffer(SYSLOG_BUFFER_SIZE); + if (sSyslogBuffer == NULL) { + status = B_NO_MEMORY; + goto err2; + } + + // initialize syslog message + sSyslogMessage->from = 0; + sSyslogMessage->options = LOG_KERN; + sSyslogMessage->priority = LOG_DEBUG; + sSyslogMessage->ident[0] = '\0'; + //strcpy(sSyslogMessage->ident, "KERNEL"); + + if (args->debug_output != NULL) + syslog_write((const char*)args->debug_output, args->debug_size); + + return B_OK; + +err3: + free(sSyslogBuffer); +err2: + free(sSyslogMessage); +err1: + sSyslogOutputEnabled = false; + return status; +} + + +// #pragma mark - private kernel API + + +void +debug_stop_screen_debug_output(void) +{ + sDebugScreenEnabled = false; +} + + +bool +debug_debugger_running(void) +{ + return sDebuggerOnCPU != -1; +} + + +void +debug_puts(const char *string, int32 length) +{ + cpu_status state = disable_interrupts(); + acquire_spinlock(&sSpinlock); + + if (length >= OUTPUT_BUFFER_SIZE) + length = OUTPUT_BUFFER_SIZE - 1; + + if (length > 1 && string[length - 1] == '\n' + && strncmp(string, sLastOutputBuffer, length) == 0) { + sMessageRepeatCount++; + sMessageRepeatLastTime = system_time(); + if (sMessageRepeatFirstTime == 0) + sMessageRepeatFirstTime = sMessageRepeatLastTime; + } else { + flush_pending_repeats(); + kputs(string); + + // kputs() doesn't output to syslog (as it's only used + // from the kernel debugger elsewhere) + if (sSyslogOutputEnabled) + syslog_write(string, length); + + memcpy(sLastOutputBuffer, string, length); + sLastOutputBuffer[length] = 0; + } + + release_spinlock(&sSpinlock); + restore_interrupts(state); +} + + +void +debug_early_boot_message(const char *string) +{ + arch_debug_serial_early_boot_message(string); +} + + +status_t +debug_init(kernel_args *args) +{ + return arch_debug_console_init(args); +} + + +status_t +debug_init_post_vm(kernel_args *args) +{ + void *handle; + + add_debugger_command("help", &cmd_help, "List all debugger commands"); + add_debugger_command("reboot", &cmd_reboot, "Reboot the system"); + add_debugger_command("shutdown", &cmd_shutdown, "Shut down the system"); + add_debugger_command("gdb", &cmd_gdb, "Connect to remote gdb"); + add_debugger_command("exit", &cmd_continue, "Same as \"continue\""); + add_debugger_command("es", &cmd_continue, "Same as \"continue\""); + add_debugger_command("continue", &cmd_continue, "Leave kernel debugger"); + + frame_buffer_console_init(args); + arch_debug_console_init_settings(args); + tracing_init(); + + // get debug settings + handle = load_driver_settings("kernel"); + if (handle != NULL) { + sSerialDebugEnabled = get_driver_boolean_parameter(handle, + "serial_debug_output", sSerialDebugEnabled, sSerialDebugEnabled); + sSyslogOutputEnabled = get_driver_boolean_parameter(handle, + "syslog_debug_output", sSyslogOutputEnabled, sSyslogOutputEnabled); + sBlueScreenOutput = get_driver_boolean_parameter(handle, + "bluescreen", true, true); + + unload_driver_settings(handle); + } + + handle = load_driver_settings(B_SAFEMODE_DRIVER_SETTINGS); + if (handle != NULL) { + sDebugScreenEnabled = get_driver_boolean_parameter(handle, + "debug_screen", false, false); + + unload_driver_settings(handle); + } + + if ((sBlueScreenOutput || sDebugScreenEnabled) + && blue_screen_init() != B_OK) + sBlueScreenOutput = sDebugScreenEnabled = false; + + if (sDebugScreenEnabled) + blue_screen_enter(true); + + syslog_init(args); + + return arch_debug_init(args); +} + + +status_t +debug_init_post_modules(struct kernel_args *args) +{ + void *cookie; + + // check for dupped lines every 10/10 second + register_kernel_daemon(check_pending_repeats, NULL, 10); + + syslog_init_post_threads(); + + // load kernel debugger addons + cookie = open_module_list("debugger"); + while (true) { + char name[B_FILE_NAME_LENGTH]; + size_t nameLength = sizeof(name); + module_info *module; + + if (read_next_module_name(cookie, name, &nameLength) != B_OK) + break; + if (get_module(name, &module) == B_OK) + dprintf("kernel debugger extention \"%s\": loaded\n", name); + else + dprintf("kernel debugger extention \"%s\": failed to load\n", name); + } + close_module_list(cookie); + + return frame_buffer_console_init_post_modules(args); +} + + +// #pragma mark - public API + + +int +add_debugger_command(char *name, int (*func)(int, char **), char *desc) +{ + cpu_status state; + struct debugger_command *cmd; + + cmd = (struct debugger_command *)malloc(sizeof(struct debugger_command)); + if (cmd == NULL) + return ENOMEM; + + cmd->func = func; + cmd->name = name; + cmd->description = desc; + + state = disable_interrupts(); + acquire_spinlock(&sSpinlock); + + cmd->next = sCommands; + sCommands = cmd; + + release_spinlock(&sSpinlock); + restore_interrupts(state); + + return B_NO_ERROR; +} + + +int +remove_debugger_command(char * name, int (*func)(int, char **)) +{ + struct debugger_command *cmd = sCommands; + struct debugger_command *prev = NULL; + cpu_status state; + + state = disable_interrupts(); + acquire_spinlock(&sSpinlock); + + while (cmd) { + if (!strcmp(cmd->name, name) && cmd->func == func) + break; + + prev = cmd; + cmd = cmd->next; + } + + if (cmd) { + if (cmd == sCommands) + sCommands = cmd->next; + else + prev->next = cmd->next; + } + + release_spinlock(&sSpinlock); + restore_interrupts(state); + + if (cmd) { + free(cmd); + return B_NO_ERROR; + } + + return B_NAME_NOT_FOUND; +} + + +uint32 +parse_expression(const char *expression) +{ + // TODO: Implement expression parser (cf. BeBook). + return strtoul(expression, NULL, 0); +} + + +void +panic(const char *format, ...) +{ + va_list args; + char temp[128]; + + va_start(args, format); + vsnprintf(temp, sizeof(temp), format, args); + va_end(args); + + kernel_debugger(temp); +} + + +void +kernel_debugger(const char *message) +{ + static vint32 inDebugger; + cpu_status state; + bool dprintfState; + + state = disable_interrupts(); + atomic_add(&inDebugger, 1); + + arch_debug_save_registers(&dbg_register_file[smp_get_current_cpu()][0]); + dprintfState = set_dprintf_enabled(true); + + if (sDebuggerOnCPU != smp_get_current_cpu()) { + // First entry, halt all of the other cpus + + // XXX need to flush current smp mailbox to make sure this goes + // through. Otherwise it'll hang + smp_send_broadcast_ici(SMP_MSG_CPU_HALT, 0, 0, 0, (void *)&inDebugger, + SMP_MSG_FLAG_SYNC); + } + + if (sBlueScreenOutput) { + if (blue_screen_enter(false) == B_OK) + sBlueScreenEnabled = true; + } + + if (message) + kprintf("PANIC: %s\n", message); + + kernel_debugger_loop(); + + set_dprintf_enabled(dprintfState); + + sBlueScreenEnabled = false; + atomic_add(&inDebugger, -1); + restore_interrupts(state); + + // ToDo: in case we change dbg_register_file - don't we want to restore it? +} + + +bool +set_dprintf_enabled(bool newState) +{ + bool oldState = sSerialDebugEnabled; + sSerialDebugEnabled = newState; + + return oldState; +} + + +static void +flush_pending_repeats(void) +{ + if (sMessageRepeatCount > 0) { + int32 length; + + if (sMessageRepeatCount > 1) { + static char temp[40]; + length = snprintf(temp, sizeof(temp), + "Last message repeated %ld times.\n", sMessageRepeatCount); + + if (sSerialDebugEnabled) + arch_debug_serial_puts(temp); + if (sSyslogOutputEnabled) + syslog_write(temp, length); + if (sBlueScreenEnabled || sDebugScreenEnabled) + blue_screen_puts(temp); + } else { + // if we only have one repeat just reprint the last buffer + if (sSerialDebugEnabled) + arch_debug_serial_puts(sLastOutputBuffer); + if (sSyslogOutputEnabled) + syslog_write(sLastOutputBuffer, strlen(sLastOutputBuffer)); + if (sBlueScreenEnabled || sDebugScreenEnabled) + blue_screen_puts(sLastOutputBuffer); + } + + sMessageRepeatFirstTime = 0; + sMessageRepeatCount = 0; + } +} + + +static void +check_pending_repeats(void *data, int iter) +{ + (void)data; + (void)iter; + if (sMessageRepeatCount > 0 + && ((system_time() - sMessageRepeatLastTime) > 1000000 + || (system_time() - sMessageRepeatFirstTime) > 3000000)) { + cpu_status state = disable_interrupts(); + acquire_spinlock(&sSpinlock); + + flush_pending_repeats(); + + release_spinlock(&sSpinlock); [... truncated: 172 lines follow ...] From bonefish at mail.berlios.de Mon Jan 14 13:44:14 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 14 Jan 2008 13:44:14 +0100 Subject: [Haiku-commits] r23512 - haiku/trunk/src/system/kernel/arch/x86 Message-ID: <200801141244.m0ECiENm011003@sheep.berlios.de> Author: bonefish Date: 2008-01-14 13:44:14 +0100 (Mon, 14 Jan 2008) New Revision: 23512 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23512&view=rev Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug_console.c Log: * Fixed incorrect key code for DELETE. Ctrl-Alt-Del will reset the system when pressed during the boot process, as intended. * Removed other incorrect key codes, except the one for BREAK, since it is used (but won't work). * Ctrl-Alt-Del now also resets the machine when in KDL, at least when waiting for user input. * arch_debug_blue_screen_getchar() does also generate the respective escape sequences for HOME, END, and DELETE, now. Furthermore it generates characters for Ctrl-A through Ctrl-Z. Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug_console.c =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_debug_console.c 2008-01-14 09:50:32 UTC (rev 23511) +++ haiku/trunk/src/system/kernel/arch/x86/arch_debug_console.c 2008-01-14 12:44:14 UTC (rev 23512) @@ -50,18 +50,18 @@ RIGHT_SHIFT = 54, LEFT_CONTROL = 29, - RIGHT_CONTROL = 157, LEFT_ALT = 56, - RIGHT_ALT = 184, CURSOR_LEFT = 75, CURSOR_RIGHT = 77, CURSOR_UP = 72, CURSOR_DOWN = 80, + CURSOR_HOME = 71, + CURSOR_END = 79, - BREAK = 198, - DELETE = 201, + BREAK = 198, // TODO: >= 128 can't be valid + DELETE = 83, F12 = 88, }; @@ -99,6 +99,7 @@ static spinlock sSerialOutputSpinlock = 0; + static void put_char(const char c) { @@ -126,7 +127,7 @@ static int32 debug_keyboard_interrupt(void *data) { - static bool controlPressed; + static bool controlPressed = false; static bool altPressed; uint8 key; @@ -201,8 +202,11 @@ /* polling the keyboard, similar to code in keyboard * driver, but without using an interrupt */ - static bool shift = false; + static bool shiftPressed = false; + static bool controlPressed = false; + static bool altPressed = false; static uint8 special = 0; + static uint8 special2 = 0; uint8 key, ascii = 0; if (special & 0x80) { @@ -214,6 +218,11 @@ special = 0; return key; } + if (special2 != 0) { + key = special2; + special2 = 0; + return key; + } while (true) { uint8 status = in8(PS2_PORT_CTRL); @@ -234,16 +243,34 @@ if (key & 0x80) { // key up - if (key == (0x80 | LEFT_SHIFT) || key == (0x80 | RIGHT_SHIFT)) - shift = false; + switch (key & ~0x80) { + case LEFT_SHIFT: + case RIGHT_SHIFT: + shiftPressed = false; + break; + case LEFT_CONTROL: + controlPressed = false; + break; + case LEFT_ALT: + altPressed = false; + break; + } } else { // key down switch (key) { case LEFT_SHIFT: case RIGHT_SHIFT: - shift = true; + shiftPressed = true; break; + case LEFT_CONTROL: + controlPressed = true; + break; + + case LEFT_ALT: + altPressed = true; + break; + // start escape sequence for cursor movement case CURSOR_UP: special = 0x80 | 'A'; @@ -257,9 +284,30 @@ case CURSOR_LEFT: special = 0x80 | 'D'; return '\x1b'; + case CURSOR_HOME: + special = 0x80 | 'H'; + return '\x1b'; + case CURSOR_END: + special = 0x80 | 'F'; + return '\x1b'; + case DELETE: + if (controlPressed && altPressed) + arch_cpu_shutdown(true); + + special = 0x80 | '3'; + special2 = '~'; + return '\x1b'; + default: - return shift ? kShiftedKeymap[key] : kUnshiftedKeymap[key]; + if (controlPressed) { + char c = kShiftedKeymap[key]; + if (c >= 'A' && c <= 'Z') + return 0x1f & c; + } + + return shiftPressed + ? kShiftedKeymap[key] : kUnshiftedKeymap[key]; } } } From jackburton at mail.berlios.de Mon Jan 14 13:48:03 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 14 Jan 2008 13:48:03 +0100 Subject: [Haiku-commits] r23513 - haiku/trunk/build/jam Message-ID: <200801141248.m0ECm3Xg011366@sheep.berlios.de> Author: jackburton Date: 2008-01-14 13:48:03 +0100 (Mon, 14 Jan 2008) New Revision: 23513 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23513&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Remove hangman from the build as it doesn't link. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-01-14 12:44:14 UTC (rev 23512) +++ haiku/trunk/build/jam/HaikuImage 2008-01-14 12:48:03 UTC (rev 23513) @@ -140,7 +140,7 @@ AddFilesToHaikuImage beos system add-ons kernel busses usb : uhci ehci ; AddFilesToHaikuImage beos system add-ons kernel console : vga_text ; -AddFilesToHaikuImage beos system add-ons kernel debugger : hangman ; +#AddFilesToHaikuImage beos system add-ons kernel debugger : hangman ; AddFilesToHaikuImage beos system add-ons kernel file_systems : $(BEOS_ADD_ONS_FILE_SYSTEMS) ; AddFilesToHaikuImage beos system add-ons kernel generic From bonefish at mail.berlios.de Mon Jan 14 13:48:14 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 14 Jan 2008 13:48:14 +0100 Subject: [Haiku-commits] r23514 - haiku/trunk/src/system/kernel/debug Message-ID: <200801141248.m0ECmEKS011409@sheep.berlios.de> Author: bonefish Date: 2008-01-14 13:48:13 +0100 (Mon, 14 Jan 2008) New Revision: 23514 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23514&view=rev Modified: haiku/trunk/src/system/kernel/debug/debug.cpp Log: Added support for line editing in KDL. Modified: haiku/trunk/src/system/kernel/debug/debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.cpp 2008-01-14 12:48:03 UTC (rev 23513) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2008-01-14 12:48:13 UTC (rev 23514) @@ -141,11 +141,61 @@ } +static void +insert_char_into_line(char* buffer, int32& position, int32& length, char c) +{ + // make room for the new char in the buffer by moving the subsequent ones + if (position < length) + memmove(buffer + position + 1, buffer + position, length - position); + + buffer[position++] = c; + length++; + + // print the char + kputchar(c); + + // print the rest of the line again, if necessary + if (position < length) { + for (int32 i = position; i < length; i++) + kputchar(buffer[i]); + + // reposition the cursor + kprintf("\x1b[%ldD", length - position); + } +} + + +static void +remove_char_from_line(char* buffer, int32& position, int32& length) +{ + if (position == length) + return; + + length--; + + if (position < length) { + // move the subsequent chars + memmove(buffer + position, buffer + position + 1, length - position); + + // print the rest of the line again, if necessary + for (int32 i = position; i < length; i++) + kputchar(buffer[i]); + } + + // visually clear the last char + kputchar(' '); + + // reposition the cursor + kprintf("\x1b[%ldD", length - position + 1); +} + + static int read_line(char *buffer, int32 maxLength) { int32 currentHistoryLine = sCurrentLine; int32 position = 0; + int32 length = 0; bool done = false; char c; @@ -161,18 +211,29 @@ switch (c) { case '\n': case '\r': - buffer[position++] = '\0'; + buffer[length++] = '\0'; kputchar('\n'); done = true; break; case 8: // backspace if (position > 0) { kputs("\x1b[1D"); // move to the left one - kputchar(' '); - kputs("\x1b[1D"); // move to the left one position--; + remove_char_from_line(buffer, position, length); } break; + case 0x1f & 'K': // CTRL-K -- clear line after current position + if (position < length) { + // clear chars + for (int32 i = position; i < length; i++) + kputchar(' '); + + // reposition cursor + kprintf("\x1b[%ldD", length - position); + + length = position; + } + break; case 27: // escape sequence c = readChar(); if (c != '[') { @@ -181,15 +242,15 @@ } c = readChar(); switch (c) { - case 'C': // right arrow acts like space - buffer[position++] = ' '; - kputchar(' '); + case 'C': // right arrow + if (position < length) { + kputs("\x1b[1C"); // move to the right one + position++; + } break; - case 'D': // left arrow acts like backspace + case 'D': // left arrow if (position > 0) { kputs("\x1b[1D"); // move to the left one - kputchar(' '); - kputs("\x1b[1D"); // move to the left one position--; } break; @@ -198,7 +259,7 @@ { int32 historyLine = 0; - if (c == 65) { + if (c == 'A') { // up arrow historyLine = currentHistoryLine - 1; if (historyLine < 0) @@ -223,11 +284,38 @@ kprintf("\x1b[%ldD", position); // move to beginning of line strcpy(buffer, sLineBuffer[historyLine]); - position = strlen(buffer); + length = position = strlen(buffer); kprintf("%s\x1b[K", buffer); // print the line and clear the rest currentHistoryLine = historyLine; break; } + case 'H': // home + { + if (position > 0) { + kprintf("\x1b[%ldD", position); + position = 0; + } + break; + } + case 'F': // end + { + if (position < length) { + kprintf("\x1b[%ldC", length - position); + position = length; + } + break; + } + case '3': // if "3~", it's DEL + { + c = readChar(); + if (c != '~') + break; + + if (position < length) + remove_char_from_line(buffer, position, length); + + break; + } default: break; } @@ -249,22 +337,20 @@ } /* supposed to fall through */ default: - if (isprint(c)) { - buffer[position++] = c; - kputchar(c); - } + if (isprint(c)) + insert_char_into_line(buffer, position, length, c); break; } - if (position >= maxLength - 2) { - buffer[position++] = '\0'; + if (length >= maxLength - 2) { + buffer[length++] = '\0'; kputchar('\n'); done = true; break; } } - return position; + return length; } From stefano.ceccherini at gmail.com Mon Jan 14 13:50:10 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Mon, 14 Jan 2008 13:50:10 +0100 Subject: [Haiku-commits] r23513 - haiku/trunk/build/jam In-Reply-To: <200801141248.m0ECm3Xg011366@sheep.berlios.de> References: <200801141248.m0ECm3Xg011366@sheep.berlios.de> Message-ID: <894b9700801140450k4ce367eaod603af876c2feda7@mail.gmail.com> 2008/1/14, jackburton at BerliOS : > Author: jackburton > Date: 2008-01-14 13:48:03 +0100 (Mon, 14 Jan 2008) > New Revision: 23513 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23513&view=rev > > Modified: > haiku/trunk/build/jam/HaikuImage > Log: > Remove hangman from the build as it doesn't link. > Undefined reference to kgets(char *, int), if that rings a bell to someone. From jackburton at mail.berlios.de Mon Jan 14 13:59:24 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 14 Jan 2008 13:59:24 +0100 Subject: [Haiku-commits] r23515 - haiku/trunk/src/apps/terminal Message-ID: <200801141259.m0ECxOl3012129@sheep.berlios.de> Author: jackburton Date: 2008-01-14 13:59:24 +0100 (Mon, 14 Jan 2008) New Revision: 23515 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23515&view=rev Modified: haiku/trunk/src/apps/terminal/Shell.cpp Log: system() works correctly, so we can use its return value now. Modified: haiku/trunk/src/apps/terminal/Shell.cpp =================================================================== --- haiku/trunk/src/apps/terminal/Shell.cpp 2008-01-14 12:48:13 UTC (rev 23514) +++ haiku/trunk/src/apps/terminal/Shell.cpp 2008-01-14 12:59:24 UTC (rev 23515) @@ -277,7 +277,7 @@ /* * Get a pseudo-tty. We do this by cycling through files in the - * directory. The operationg system will not allow us to open a master + * directory. The operating system will not allow us to open a master * which is already in use, so we simply go until the open succeeds. */ char ttyName[B_PATH_NAME_LENGTH]; @@ -488,17 +488,15 @@ * Exec failed. */ sleep(1); - /*const char *spawnAlertMessage = "alert --stop " + const char *spawnAlertMessage = "alert --stop " "'Cannot execute \"%s\":\n" "\t%s' " "'Use Default Shell' 'Abort'"; char errorMessage[256]; - snprintf(errorMessage, sizeof(errorMessage), spawnAlertMessage, commandLine, strerror(errno)); + snprintf(errorMessage, sizeof(errorMessage), spawnAlertMessage, *argv, strerror(errno)); - // TODO: I'm not sure that system should return the return value of alert. - // At least, it's not doing that right now. int returnValue = system(errorMessage); - if (returnValue == 0)*/ + if (returnValue == 0) execl("/bin/sh", "/bin/sh", "-login", NULL); exit(1); From bonefish at mail.berlios.de Mon Jan 14 14:04:14 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 14 Jan 2008 14:04:14 +0100 Subject: [Haiku-commits] r23516 - haiku/trunk/src/system/kernel/debug Message-ID: <200801141304.m0ED4EAP012730@sheep.berlios.de> Author: bonefish Date: 2008-01-14 14:04:13 +0100 (Mon, 14 Jan 2008) New Revision: 23516 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23516&view=rev Modified: haiku/trunk/src/system/kernel/debug/debug.cpp Log: Added "message" debugger command to reprint the message printed when entering KDL. Modified: haiku/trunk/src/system/kernel/debug/debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.cpp 2008-01-14 12:59:24 UTC (rev 23515) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2008-01-14 13:04:13 UTC (rev 23516) @@ -67,6 +67,8 @@ static jmp_buf sInvokeCommandEnv; static bool sInvokeCommandDirectly = false; +static const char* sCurrentKernelDebuggerMessage; + #define SYSLOG_BUFFER_SIZE 65536 #define OUTPUT_BUFFER_SIZE 1024 static char sOutputBuffer[OUTPUT_BUFFER_SIZE]; @@ -563,6 +565,18 @@ } +static int +cmd_dump_kdl_message(int argc, char **argv) +{ + if (sCurrentKernelDebuggerMessage) { + kputs(sCurrentKernelDebuggerMessage); + kputchar('\n'); + } + + return 0; +} + + static status_t syslog_sender(void *data) { @@ -806,6 +820,8 @@ add_debugger_command("exit", &cmd_continue, "Same as \"continue\""); add_debugger_command("es", &cmd_continue, "Same as \"continue\""); add_debugger_command("continue", &cmd_continue, "Leave kernel debugger"); + add_debugger_command("message", &cmd_dump_kdl_message, + "Reprint the message printed when entering KDL"); frame_buffer_console_init(args); arch_debug_console_init_settings(args); @@ -994,6 +1010,8 @@ if (message) kprintf("PANIC: %s\n", message); + sCurrentKernelDebuggerMessage = message; + kernel_debugger_loop(); set_dprintf_enabled(dprintfState); From stefano.ceccherini at gmail.com Mon Jan 14 14:05:23 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Mon, 14 Jan 2008 14:05:23 +0100 Subject: [Haiku-commits] r23513 - haiku/trunk/build/jam In-Reply-To: <894b9700801140450k4ce367eaod603af876c2feda7@mail.gmail.com> References: <200801141248.m0ECm3Xg011366@sheep.berlios.de> <894b9700801140450k4ce367eaod603af876c2feda7@mail.gmail.com> Message-ID: <894b9700801140505y5f58be3k5af785c7cca0d650@mail.gmail.com> 2008/1/14, Stefano Ceccherini : > 2008/1/14, jackburton at BerliOS : > > Author: jackburton > > Date: 2008-01-14 13:48:03 +0100 (Mon, 14 Jan 2008) > > New Revision: 23513 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23513&view=rev > > > > Modified: > > haiku/trunk/build/jam/HaikuImage > > Log: > > Remove hangman from the build as it doesn't link. > > > > Undefined reference to kgets(char *, int), if that rings a bell to someone. Looks like r23511 is the culprit. kgets() is mangled as C++ function now. Either we add an "extern "C"" guard or hangman has to use another (public) method... well, I don't know why hangman needs it, so... From bonefish at mail.berlios.de Mon Jan 14 14:08:43 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 14 Jan 2008 14:08:43 +0100 Subject: [Haiku-commits] r23517 - haiku/trunk/src/system/kernel/debug Message-ID: <200801141308.m0ED8h21013177@sheep.berlios.de> Author: bonefish Date: 2008-01-14 14:08:43 +0100 (Mon, 14 Jan 2008) New Revision: 23517 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23517&view=rev Modified: haiku/trunk/src/system/kernel/debug/debug.cpp Log: Use C linkage for kgets(). Should fix hangman. Modified: haiku/trunk/src/system/kernel/debug/debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.cpp 2008-01-14 13:04:13 UTC (rev 23516) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2008-01-14 13:08:43 UTC (rev 23517) @@ -36,7 +36,7 @@ #include -int kgets(char *buffer, int length); +extern "C" int kgets(char *buffer, int length); typedef struct debugger_command { struct debugger_command *next; From ingo_weinhold at gmx.de Mon Jan 14 14:10:21 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 14 Jan 2008 14:10:21 +0100 Subject: [Haiku-commits] r23513 - haiku/trunk/build/jam In-Reply-To: <894b9700801140450k4ce367eaod603af876c2feda7@mail.gmail.com> References: <200801141248.m0ECm3Xg011366@sheep.berlios.de> <894b9700801140450k4ce367eaod603af876c2feda7@mail.gmail.com> Message-ID: <20080114141021.1465.3@knochen-vm.nameserver> On 2008-01-14 at 13:50:10 [+0100], Stefano Ceccherini wrote: > 2008/1/14, jackburton at BerliOS : > > Author: jackburton > > Date: 2008-01-14 13:48:03 +0100 (Mon, 14 Jan 2008) > > New Revision: 23513 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23513&view=rev > > > > Modified: > > haiku/trunk/build/jam/HaikuImage > > Log: > > Remove hangman from the build as it doesn't link. > > > > Undefined reference to kgets(char *, int), if that rings a bell to someone. That's what one gets when using private kernel API. Or plain C for that matter. ;-) Should be fixed in r23517. CU, Ingo From jackburton at mail.berlios.de Mon Jan 14 14:52:16 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 14 Jan 2008 14:52:16 +0100 Subject: [Haiku-commits] r23518 - haiku/trunk/src/kits/interface Message-ID: <200801141352.m0EDqGDu017453@sheep.berlios.de> Author: jackburton Date: 2008-01-14 14:52:15 +0100 (Mon, 14 Jan 2008) New Revision: 23518 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23518&view=rev Modified: haiku/trunk/src/kits/interface/ColorControl.cpp Log: use B_NO_POINTER_HISTORY in SetMouseEventMask(). Modified: haiku/trunk/src/kits/interface/ColorControl.cpp =================================================================== --- haiku/trunk/src/kits/interface/ColorControl.cpp 2008-01-14 13:08:43 UTC (rev 23517) +++ haiku/trunk/src/kits/interface/ColorControl.cpp 2008-01-14 13:52:15 UTC (rev 23518) @@ -596,7 +596,7 @@ SetTracking(true); MakeFocus(); - SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); + SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY|B_LOCK_WINDOW_FOCUS); } From jackburton at mail.berlios.de Mon Jan 14 14:56:52 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 14 Jan 2008 14:56:52 +0100 Subject: [Haiku-commits] r23519 - haiku/trunk/src/apps/terminal Message-ID: <200801141356.m0EDuq6c017763@sheep.berlios.de> Author: jackburton Date: 2008-01-14 14:56:52 +0100 (Mon, 14 Jan 2008) New Revision: 23519 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23519&view=rev Removed: haiku/trunk/src/apps/terminal/ColorWindow.cpp haiku/trunk/src/apps/terminal/ColorWindow.h Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp Log: Removed unused files Deleted: haiku/trunk/src/apps/terminal/ColorWindow.cpp Deleted: haiku/trunk/src/apps/terminal/ColorWindow.h Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-01-14 13:52:15 UTC (rev 23518) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-01-14 13:56:52 UTC (rev 23519) @@ -11,7 +11,6 @@ #include "Arguments.h" #include "Coding.h" -#include "ColorWindow.h" #include "MenuUtil.h" #include "FindWindow.h" #include "PrefWindow.h" From axeld at mail.berlios.de Mon Jan 14 15:04:35 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 14 Jan 2008 15:04:35 +0100 Subject: [Haiku-commits] r23520 - haiku/trunk/src/system/kernel/debug Message-ID: <200801141404.m0EE4ZiG018311@sheep.berlios.de> Author: axeld Date: 2008-01-14 15:04:35 +0100 (Mon, 14 Jan 2008) New Revision: 23520 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23520&view=rev Modified: haiku/trunk/src/system/kernel/debug/tracing.cpp Log: * If the "traced" KDL command is used with only one argument, it's the index now, not the number of entries shown (much more usable this way). * Added missing license. Modified: haiku/trunk/src/system/kernel/debug/tracing.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/tracing.cpp 2008-01-14 13:56:52 UTC (rev 23519) +++ haiku/trunk/src/system/kernel/debug/tracing.cpp 2008-01-14 14:04:35 UTC (rev 23520) @@ -1,10 +1,17 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + #include +#include + #include -#include - #if ENABLE_TRACING //#define TRACE_TRACING @@ -179,11 +186,11 @@ pattern = argv[--argc] + 1; int32 count = 30; + int32 start = sEntries - count; + if (argc == 2) - count = strtol(argv[1], NULL, 0); + start = strtol(argv[1], NULL, 0); - int32 start = sEntries - count; - if (argc == 3) { start = strtol(argv[1], NULL, 0); count = strtol(argv[2], NULL, 0); @@ -238,6 +245,7 @@ #endif // ENABLE_TRACING + extern "C" uint8* alloc_tracing_buffer(size_t size) { From mmlr at mlotz.ch Mon Jan 14 15:11:32 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Mon, 14 Jan 2008 15:11:32 +0100 Subject: [Haiku-commits] r23424 - haiku/trunk/src/kits/interface In-Reply-To: <894b9700801140011m11acbcafhd0475b62647e10db@mail.gmail.com> References: <200801112312.m0BNCgHX000132@sheep.berlios.de> <894b9700801140011m11acbcafhd0475b62647e10db@mail.gmail.com> Message-ID: <20080114140819.M62306@mlotz.ch> On Mon, 14 Jan 2008 09:11:15 +0100, Stefano Ceccherini wrote > 2008/1/12, mmlr at BerliOS : > > Author: mmlr > > Date: 2008-01-12 00:12:41 +0100 (Sat, 12 Jan 2008) > > New Revision: 23424 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23424&view=rev > > Shouldn't this be changed also in BView::SetFlags() ? Not really. In SetFlags() you already provide a combined uint32 containing both resize mask and flags. SetFlags() only masks off invalid/unused flags but then recombines them to the uint32 fFlags again. Regards Michael From mmlr at mlotz.ch Mon Jan 14 15:24:06 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Mon, 14 Jan 2008 15:24:06 +0100 Subject: [Haiku-commits] r23424 - haiku/trunk/src/kits/interface In-Reply-To: <20080114140819.M62306@mlotz.ch> References: <200801112312.m0BNCgHX000132@sheep.berlios.de> <894b9700801140011m11acbcafhd0475b62647e10db@mail.gmail.com> <20080114140819.M62306@mlotz.ch> Message-ID: <20080114141956.M7772@mlotz.ch> On Mon, 14 Jan 2008 15:11:32 +0100, Michael Lotz wrote > > Shouldn't this be changed also in BView::SetFlags() ? > > Not really. In SetFlags() you already provide a combined uint32 containing > both resize mask and flags. SetFlags() only masks off invalid/unused > flags but then recombines them to the uint32 fFlags again. Correction: In SetFlags() you only provide flags and in SetResizingMode() you only provide the resizing mode. So there is now way you could accidentally mix them up. In the constructor though it can easily happen if you write BView(frame, name, flags, resizeMask) instead of the correct BView(frame, name, resizeMask, flags). Regards Michael From stefano.ceccherini at gmail.com Mon Jan 14 15:26:47 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Mon, 14 Jan 2008 15:26:47 +0100 Subject: [Haiku-commits] r23424 - haiku/trunk/src/kits/interface In-Reply-To: <20080114141956.M7772@mlotz.ch> References: <200801112312.m0BNCgHX000132@sheep.berlios.de> <894b9700801140011m11acbcafhd0475b62647e10db@mail.gmail.com> <20080114140819.M62306@mlotz.ch> <20080114141956.M7772@mlotz.ch> Message-ID: <894b9700801140626j2754eb44p9f9be47882262c8d@mail.gmail.com> 2008/1/14, Michael Lotz : > Correction: In SetFlags() you only provide flags and in SetResizingMode() you > only provide the resizing mode. So there is now way you could accidentally mix > them up. In the constructor though it can easily happen if you write > BView(frame, name, flags, resizeMask) instead of the correct BView(frame, > name, resizeMask, flags). That's right. Sorry for bothering. From bonefish at mail.berlios.de Mon Jan 14 16:39:45 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 14 Jan 2008 16:39:45 +0100 Subject: [Haiku-commits] r23521 - haiku/trunk/src/system/kernel/debug Message-ID: <200801141539.m0EFdjQk026460@sheep.berlios.de> Author: bonefish Date: 2008-01-14 16:39:44 +0100 (Mon, 14 Jan 2008) New Revision: 23521 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23521&view=rev Modified: haiku/trunk/src/system/kernel/debug/debug.cpp Log: * Sort the registered commands by name when entering KDL. * Don't execute a command anymore, if the given prefix is ambiguous. * Added tab completion for commands. * Added on-the-fly help while typing a command line. It is triggered by pressing tab at a position after the space following the command. It is implemented by calling the command with argument "--help", which doesn't work yet with most commands, but some already print their usage in this case. Modified: haiku/trunk/src/system/kernel/debug/debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.cpp 2008-01-14 14:04:35 UTC (rev 23520) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2008-01-14 15:39:44 UTC (rev 23521) @@ -36,7 +36,11 @@ #include +static const char* const kKDLPrompt = "kdebug> "; + extern "C" int kgets(char *buffer, int length); +static int invoke_command(struct debugger_command *command, int argc, + char** argv); typedef struct debugger_command { struct debugger_command *next; @@ -93,12 +97,28 @@ #define distance(a, b) ((a) < (b) ? (b) - (a) : (a) - (b)) +static debugger_command* +next_command(debugger_command* command, const char* prefix, int prefixLen) +{ + if (command == NULL) + command = sCommands; + else + command = command->next; + + while (command != NULL && !strncmp(prefix, command->name, prefixLen) == 0) + command = command->next; + + return command; +} + + static debugger_command * -find_command(char *name, bool partialMatch) +find_command(const char *name, bool partialMatch, bool& ambiguous) { debugger_command *command; - int length; + ambiguous = false; + // search command by full name for (command = sCommands; command != NULL; command = command->next) { @@ -109,13 +129,13 @@ // if it couldn't be found, search for a partial match if (partialMatch) { - length = strlen(name); - if (length == 0) - return NULL; + int length = strlen(name); + command = next_command(NULL, name, length); + if (command != NULL) { + if (next_command(command, name, length) == NULL) + return command; - for (command = sCommands; command != NULL; command = command->next) { - if (strncmp(name, command->name, length) == 0) - return command; + ambiguous = true; } } @@ -144,30 +164,39 @@ static void -insert_char_into_line(char* buffer, int32& position, int32& length, char c) +insert_chars_into_line(char* buffer, int32& position, int32& length, + const char* chars, int32 charCount) { - // make room for the new char in the buffer by moving the subsequent ones - if (position < length) - memmove(buffer + position + 1, buffer + position, length - position); + // move the following chars to make room for the ones to insert + if (position < length) { + memmove(buffer + position + charCount, buffer + position, + length - position); + } - buffer[position++] = c; - length++; + // insert chars + memcpy(buffer + position, chars, charCount); + int32 oldPosition = position; + position += charCount; + length += charCount; - // print the char - kputchar(c); + // print the new chars (and the following ones) + kprintf("%.*s", (int)(length - oldPosition), + buffer + oldPosition); - // print the rest of the line again, if necessary - if (position < length) { - for (int32 i = position; i < length; i++) - kputchar(buffer[i]); - - // reposition the cursor + // reposition cursor, if necessary + if (position < length) kprintf("\x1b[%ldD", length - position); - } } static void +insert_char_into_line(char* buffer, int32& position, int32& length, char c) +{ + insert_chars_into_line(buffer, position, length, &c, 1); +} + + +static void remove_char_from_line(char* buffer, int32& position, int32& length) { if (position == length) @@ -192,8 +221,156 @@ } +class LineEditingHelper { +public: + virtual ~LineEditingHelper() {} + + virtual void TabCompletion(char* buffer, int32 capacity, int32& position, + int32& length) = 0; +}; + + +class CommandLineEditingHelper : public LineEditingHelper { +public: + CommandLineEditingHelper() + { + } + + virtual ~CommandLineEditingHelper() {} + + virtual void TabCompletion(char* buffer, int32 capacity, int32& position, + int32& length) + { + // find the first space + char tmpChar = buffer[position]; + buffer[position] = '\0'; + char* firstSpace = strchr(buffer, ' '); + buffer[position] = tmpChar; + + bool reprintLine = false; + + if (firstSpace != NULL) { + // a complete command -- print its help + + // get the command + tmpChar = *firstSpace; + *firstSpace = '\0'; + bool ambiguous; + debugger_command* command = find_command(buffer, true, ambiguous); + *firstSpace = tmpChar; + + if (command != NULL) { + kputchar('\n'); + + char* args[3] = { NULL, "--help", NULL }; + invoke_command(command, 2, args); + } else { + if (ambiguous) + kprintf("\nambiguous command\n"); + else + kprintf("\nno such command\n"); + } + + reprintLine = true; + } else { + // a partial command -- look for completions + + // check for possible completions + int32 count = 0; + int32 longestName = 0; + debugger_command* command = NULL; + int32 longestCommonPrefix = 0; + const char* previousCommandName = NULL; + while ((command = next_command(command, buffer, position)) + != NULL) { + count++; + int32 nameLength = strlen(command->name); + longestName = max_c(longestName, nameLength); + + // updated the length of the longest common prefix of the + // commands + if (count == 1) { + longestCommonPrefix = longestName; + } else { + longestCommonPrefix = min_c(longestCommonPrefix, + nameLength); + + for (int32 i = position; i < longestCommonPrefix; i++) { + if (previousCommandName[i] != command->name[i]) { + longestCommonPrefix = i; + break; + } + } + } + + previousCommandName = command->name; + } + + if (count == 0) { + // no possible completions + kprintf("\nno completions\n"); + reprintLine = true; + } else if (count == 1) { + // exactly one completion + command = next_command(NULL, buffer, position); + + // check for sufficient space in the buffer + int32 neededSpace = longestName - position + 1; + // remainder of the name plus one space + // also consider the terminating null char + if (length + neededSpace + 1 >= capacity) + return; + + insert_chars_into_line(buffer, position, length, + command->name + position, longestName - position); + insert_char_into_line(buffer, position, length, ' '); + } else if (longestCommonPrefix > position) { + // multiple possible completions with longer common prefix + // -- insert the remainder of the common prefix + + // check for sufficient space in the buffer + int32 neededSpace = longestCommonPrefix - position; + // also consider the terminating null char + if (length + neededSpace + 1 >= capacity) + return; + + insert_chars_into_line(buffer, position, length, + previousCommandName + position, neededSpace); + } else { + // multiple possible completions without longer common prefix + // -- print them all + kprintf("\n"); + reprintLine = true; + + int columns = 80 / (longestName + 2); + debugger_command* command = NULL; + int column = 0; + while ((command = next_command(command, buffer, position)) + != NULL) { + // spacing + if (column > 0 && column % columns == 0) + kputchar('\n'); + column++; + + kprintf(" %-*s", (int)longestName, command->name); + } + kputchar('\n'); + } + } + + // reprint the editing line, if necessary + if (reprintLine) { + kprintf("%s%.*s", kKDLPrompt, (int)length, buffer); + if (position < length) + kprintf("\x1b[%ldD", length - position); + } + } +}; + + static int -read_line(char *buffer, int32 maxLength) +read_line(char *buffer, int32 maxLength, + LineEditingHelper* editingHelper = NULL) { int32 currentHistoryLine = sCurrentLine; int32 position = 0; @@ -217,6 +394,14 @@ kputchar('\n'); done = true; break; + case '\t': + { + if (editingHelper != NULL) { + editingHelper->TabCompletion(buffer, maxLength, + position, length); + } + break; + } case 8: // backspace if (position > 0) { kputs("\x1b[1D"); // move to the left one @@ -471,8 +656,9 @@ struct debugger_command *cmd = NULL; int argc; - kprintf("kdebug> "); - read_line(sLineBuffer[sCurrentLine], LINE_BUFFER_SIZE); + CommandLineEditingHelper editingHelper; + kprintf(kKDLPrompt); + read_line(sLineBuffer[sCurrentLine], LINE_BUFFER_SIZE, &editingHelper); parse_line(sLineBuffer[sCurrentLine], sArguments, &argc, MAX_ARGS); // We support calling last executed command again if @@ -482,12 +668,20 @@ sDebuggerOnCPU = smp_get_current_cpu(); + bool ambiguous; if (argc > 0) - cmd = find_command(sArguments[0], true); + cmd = find_command(sArguments[0], true, ambiguous); - if (cmd == NULL) - kprintf("unknown command, enter \"help\" to get a list of all supported commands\n"); - else { + if (cmd == NULL) { + if (ambiguous) { + kprintf("Ambiguous command. Use tab completion to get a list " + "of matching commands. Enter \"help\" to get a list of " + "all supported commands.\n"); + } else { + kprintf("Unknown command. Enter \"help\" to get a list of all " + "supported commands.\n"); + } + } else { int rc = invoke_command(cmd, argc, sArguments); if (rc == B_KDEBUG_QUIT) @@ -528,9 +722,10 @@ debugger_command *command, *specified = NULL; const char *start = NULL; int32 startLength = 0; + bool ambiguous; if (argc > 1) { - specified = find_command(argv[1], false); + specified = find_command(argv[1], false, ambiguous); if (specified == NULL) { start = argv[1]; startLength = strlen(start); @@ -1012,6 +1207,28 @@ sCurrentKernelDebuggerMessage = message; + // bubble sort the commands + debugger_command* stopCommand = NULL; + while (stopCommand != sCommands) { + debugger_command** command = &sCommands; + while (true) { + debugger_command* nextCommand = (*command)->next; + if (nextCommand == stopCommand) { + stopCommand = *command; + break; + } + + if (strcmp((*command)->name, nextCommand->name) > 0) { + debugger_command* tmpCommand = nextCommand->next; + (*command)->next = nextCommand->next; + nextCommand->next = *command; + *command = nextCommand; + } + + command = &(*command)->next; + } + } + kernel_debugger_loop(); set_dprintf_enabled(dprintfState); From revol at free.fr Mon Jan 14 20:50:29 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Mon, 14 Jan 2008 20:50:29 +0100 CET Subject: [Haiku-commits] r23509 - in haiku/trunk: headers/private/libroot src/system/libroot src/system/libroot/posix In-Reply-To: <20080114103841.458.2@knochen-vm.nameserver> Message-ID: <3328256182-BeMail@laptop> > > > > +void __init_pwd_backend(void) > > +{ > > +} > > + > > The Haiku Style Police has detected a violation of the style guide. > Be > warned! Upon repeated violations the case will be submitted to the > Haiku > Style Court, and you will face a sentence of buying large quantities > of beer > for the other developers at the next BeGeistert. Eh, it's a copy-paste of the code I wrote... I'll cleanup both anyway. Coke I'd buy but beer... I don't want to be responsible for others commiting code with an even worse style than mine ! :P Fran?ois. From revol at free.fr Mon Jan 14 22:10:06 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Mon, 14 Jan 2008 22:10:06 +0100 CET Subject: [Haiku-commits] r23513 - haiku/trunk/build/jam In-Reply-To: <200801141248.m0ECm3Xg011366@sheep.berlios.de> Message-ID: <8105331173-BeMail@laptop> > Author: jackburton > Date: 2008-01-14 13:48:03 +0100 (Mon, 14 Jan 2008) > New Revision: 23513 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23513&view=rev > > Modified: > haiku/trunk/build/jam/HaikuImage > Log: > Remove hangman from the build as it doesn't link. > It does for me, both gcc2 and 4, at least it did yesterday, and has been for months, so either someone broke an exported symbol from the kernel or you screwed up :p Fran?ois. From revol at free.fr Mon Jan 14 22:17:48 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Mon, 14 Jan 2008 22:17:48 +0100 CET Subject: [Haiku-commits] r23513 - haiku/trunk/build/jam In-Reply-To: <894b9700801140505y5f58be3k5af785c7cca0d650@mail.gmail.com> Message-ID: <8567456898-BeMail@laptop> > 2008/1/14, Stefano Ceccherini : > > 2008/1/14, jackburton at BerliOS : > > > Author: jackburton > > > Date: 2008-01-14 13:48:03 +0100 (Mon, 14 Jan 2008) > > > New Revision: 23513 > > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23513&view=rev > > > > > > Modified: > > > haiku/trunk/build/jam/HaikuImage > > > Log: > > > Remove hangman from the build as it doesn't link. > > > > > > > Undefined reference to kgets(char *, int), if that rings a bell to > > someone. > > Looks like r23511 is the culprit. kgets() is mangled as C++ function > now. Either we add an "extern "C"" guard or hangman has to use > another Hmm, revol at debian:~/haiku/trunk$ nm generated/objects/haiku/x86/release/ system/kernel/kernel_x86 | grep kgets 800748d8 T kgets but I suppose just renaming to .cpp didn't count for modified for jam. > (public) method... well, I don't know why hangman needs it, so... Because it needs to read the input. plain simple. Anyway removing something because it doesn't build does not count as a fix. Fran?ois. From mmu_man at mail.berlios.de Mon Jan 14 22:26:42 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Mon, 14 Jan 2008 22:26:42 +0100 Subject: [Haiku-commits] r23522 - haiku/trunk/build/jam Message-ID: <200801142126.m0ELQgrw008563@sheep.berlios.de> Author: mmu_man Date: 2008-01-14 22:26:42 +0100 (Mon, 14 Jan 2008) New Revision: 23522 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23522&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Put it back as it works again, I can't live without it. You know, moving stuff out of your way just because they don't work won't fix them... Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-01-14 15:39:44 UTC (rev 23521) +++ haiku/trunk/build/jam/HaikuImage 2008-01-14 21:26:42 UTC (rev 23522) @@ -140,7 +140,7 @@ AddFilesToHaikuImage beos system add-ons kernel busses usb : uhci ehci ; AddFilesToHaikuImage beos system add-ons kernel console : vga_text ; -#AddFilesToHaikuImage beos system add-ons kernel debugger : hangman ; +AddFilesToHaikuImage beos system add-ons kernel debugger : hangman ; AddFilesToHaikuImage beos system add-ons kernel file_systems : $(BEOS_ADD_ONS_FILE_SYSTEMS) ; AddFilesToHaikuImage beos system add-ons kernel generic From mmu_man at mail.berlios.de Mon Jan 14 22:43:09 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Mon, 14 Jan 2008 22:43:09 +0100 Subject: [Haiku-commits] r23523 - haiku/trunk/src/add-ons/kernel/debugger/hangman Message-ID: <200801142143.m0ELh9PO015294@sheep.berlios.de> Author: mmu_man Date: 2008-01-14 22:43:09 +0100 (Mon, 14 Jan 2008) New Revision: 23523 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23523&view=rev Modified: haiku/trunk/src/add-ons/kernel/debugger/hangman/hangman.c Log: * Style cleanup * warning * implement --help Modified: haiku/trunk/src/add-ons/kernel/debugger/hangman/hangman.c =================================================================== --- haiku/trunk/src/add-ons/kernel/debugger/hangman/hangman.c 2008-01-14 21:26:42 UTC (rev 23522) +++ haiku/trunk/src/add-ons/kernel/debugger/hangman/hangman.c 2008-01-14 21:43:09 UTC (rev 23523) @@ -42,6 +42,8 @@ char words[MAX_CACHED_WORDS][MAX_LETTERS+1]; +#ifndef __HAIKU__ + /* design ripped off from http://www.latms.berkeley.k12.ca.us/perl/node30.html :) */ static char hungman[] = \ " ____ \n" \ @@ -50,6 +52,9 @@ " | %c%c%c \n" \ " | %c %c \n" \ " | \n"; + +#else + /* some colors */ static char hungman_ansi[] = \ " ____ \n" \ @@ -59,6 +64,8 @@ " | \033[35m%c %c\033[0m \n" \ " | \n"; +#endif + // for gets, #define BIGBUFFSZ 128 char bigbuffer[BIGBUFFSZ]; @@ -101,7 +108,9 @@ # define HUNGMAN hungman_ansi #endif /* !_KERNEL_MODE */ -status_t init_words(char *from) + +status_t +init_words(char *from) { int fd; size_t sz, got; @@ -154,7 +163,9 @@ return B_OK; } -void print_hangman(int fails) + +void +print_hangman(int fails) { PRINTF(HUNGMAN, (fails > 0)?'O':' ', @@ -165,7 +176,9 @@ (fails > 5)?'\\':' '); } -void display_word(int current, uint32 tried_letters) + +void +display_word(int current, uint32 tried_letters) { int i = 0; PRINTF("word> "); @@ -176,7 +189,8 @@ PRINTF("\n"); } -int play_hangman(void) +int +play_hangman(void) { int current; int score = 0; @@ -248,13 +262,15 @@ return score; } + #ifdef _KERNEL_MODE /* driver parts */ #ifndef __HAIKU__ /* BeOS intimacy revealed */ //char *bsod_wrapper_gets(char *p, int len) //char *bsod_wrapper_gets(int len, char *p) -char *bsod_wrapper_gets(char *prompt, char *p, int len) +char * +bsod_wrapper_gets(char *prompt, char *p, int len) { /* fall back to the normal gets() */ bsod_kgets = bsod_saved_kgets; @@ -268,9 +284,17 @@ #endif -int kdlhangman(int argc, char **argv) + +int +kdlhangman(int argc, char **argv) { int score; + + if (argc > 1 && strcmp(argv[1], "--help") == 0) { + PRINTF("%s\n", KCMD_HELP); + return 0; + } + score = play_hangman(); PRINTF("score %d\n", score); if (score > (MAX_CACHED_WORDS - MAX_FAILS_BEFORE_BSOD)) { @@ -290,6 +314,7 @@ return B_KDEBUG_QUIT; } + # ifdef AS_DRIVER typedef struct { @@ -298,11 +323,16 @@ const char * device_names[]={DEV_ENTRY, NULL}; -status_t init_hardware(void) { + +status_t +init_hardware(void) { return B_OK; } -status_t init_driver(void) { + +status_t +init_driver(void) +{ status_t err; err = init_words(FORTUNE_FILE); @@ -315,15 +345,24 @@ return B_OK; } -void uninit_driver(void) { + +void +uninit_driver(void) +{ remove_debugger_command("kdlhangman", kdlhangman); } -const char **publish_devices() { + +const char ** +publish_devices() +{ return device_names; } -status_t khangman_open(const char *name, uint32 flags, cookie_t **cookie) { + +status_t +khangman_open(const char *name, uint32 flags, cookie_t **cookie) +{ (void)name; (void)flags; *cookie = (void*)malloc(sizeof(cookie_t)); if (*cookie == NULL) { @@ -336,22 +375,34 @@ return B_ERROR; } -status_t khangman_close(void *cookie) { + +status_t +khangman_close(void *cookie) +{ (void)cookie; return B_OK; } -status_t khangman_free(cookie_t *cookie) { + +status_t +khangman_free(cookie_t *cookie) +{ free(cookie); return B_OK; } -status_t khangman_read(cookie_t *cookie, off_t position, void *data, size_t *numbytes) { + +status_t +khangman_read(cookie_t *cookie, off_t position, void *data, size_t *numbytes) +{ *numbytes = 0; return B_NOT_ALLOWED; } -status_t khangman_write(void *cookie, off_t position, const void *data, size_t *numbytes) { + +status_t +khangman_write(void *cookie, off_t position, const void *data, size_t *numbytes) +{ (void)cookie; (void)position; (void)data; (void)numbytes; //*numbytes = 0; /* here we get to kdlhangman */ @@ -363,6 +414,7 @@ return B_OK; } + device_hooks khangman_hooks={ (device_open_hook)khangman_open, khangman_close, @@ -376,14 +428,22 @@ NULL }; -device_hooks *find_device(const char *name) { + +device_hooks * +find_device(const char *name) +{ (void)name; return &khangman_hooks; } + # else /* as module */ + + status_t std_ops(int32 op, ...); -status_t std_ops(int32 op, ...) + +status_t +std_ops(int32 op, ...) { status_t err; @@ -403,6 +463,7 @@ return B_ERROR; } + static module_info minfo = { "debugger/hangman/v1", B_KEEP_LOADED, @@ -415,7 +476,8 @@ #else -void kdl_trip(void) +void +kdl_trip(void) { int fd; fd = open("/dev/misc/hangman", O_WRONLY); @@ -428,7 +490,9 @@ close(fd); } -int main(int argc, char *argv) + +int +main(int argc, char *argv) { int score; /* how many correct guesses ? */ /* init */ @@ -437,7 +501,7 @@ return 1; } score = play_hangman(); -PRINTF("score %d\n", score); + PRINTF("score %d\n", score); if (score > (MAX_CACHED_WORDS - MAX_FAILS_BEFORE_BSOD)) { PRINTF("Congrats !\n"); } @@ -449,5 +513,4 @@ } - #endif From mmu_man at mail.berlios.de Mon Jan 14 22:55:30 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Mon, 14 Jan 2008 22:55:30 +0100 Subject: [Haiku-commits] r23524 - haiku/trunk/src/system/ldscripts/m68k Message-ID: <200801142155.m0ELtUmq016820@sheep.berlios.de> Author: mmu_man Date: 2008-01-14 22:55:29 +0100 (Mon, 14 Jan 2008) New Revision: 23524 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23524&view=rev Added: haiku/trunk/src/system/ldscripts/m68k/boot_loader_atari_m68k.ld Removed: haiku/trunk/src/system/ldscripts/m68k/boot_loader_atari.ld Log: The correct platform is "atari_m68k". Deleted: haiku/trunk/src/system/ldscripts/m68k/boot_loader_atari.ld Copied: haiku/trunk/src/system/ldscripts/m68k/boot_loader_atari_m68k.ld (from rev 23471, haiku/trunk/src/system/ldscripts/m68k/boot_loader_atari.ld) From mmu_man at mail.berlios.de Mon Jan 14 22:59:44 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Mon, 14 Jan 2008 22:59:44 +0100 Subject: [Haiku-commits] r23525 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801142159.m0ELxiWT017087@sheep.berlios.de> Author: mmu_man Date: 2008-01-14 22:59:44 +0100 (Mon, 14 Jan 2008) New Revision: 23525 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23525&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c haiku/trunk/src/system/boot/platform/atari_m68k/shell.S Log: * checksum should be ok now... * also added fake FAT descriptors to avoid crashing TOS, but it doesn't boot yet as floppy. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c 2008-01-14 21:55:29 UTC (rev 23524) +++ haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c 2008-01-14 21:59:44 UTC (rev 23525) @@ -17,13 +17,17 @@ perror("read"); return 1; } - for (sum = 0, i = 0; i < (512-2); i++) { - sum += p[i]; + for (sum = 0, i = 0; i < (512-2)/2; i++) { + uint16_t v; + v = *p++ << 8; + v += *p++; + sum += v; } - sum = 0x1234 - sum; + sum = 0x1234 - sum + 1; + //sum = 0xaa55; // big endian - p[512-2] = (uint8_t)(sum >> 8); - p[512-1] = (uint8_t)sum; + *p++ = (uint8_t)(sum >> 8); + *p++ = (uint8_t)sum; //lseek(fd, 0LL, SEEK_SET); write(fd, §or[512-2], 2); return 0; Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-14 21:55:29 UTC (rev 23524) +++ haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-14 21:59:44 UTC (rev 23525) @@ -19,6 +19,14 @@ * the entry function of the embedded ELF part of the loader. */ +/* + * generate boot floppy: + * cd src/system/boot/platform/atari_m68k/ ; make fixup_tos_floppy_chksum; cd - + * dd if=generated/objects/haiku/m68k/release/system/boot/zbeos of=~/floppy.img bs=512 count=20 conv=notrunc + * src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum ~/floppy.img + * generate .prg: + * generated.m68k/cross-tools/bin/m68k-unknown-haiku-ld -o haiku.prg -T src/system/boot/platform/atari_m68k/prg.ld generated/objects/haiku/m68k/release/system/boot/boot_loader_atari_m68k + */ #include "atari_memory_map.h" #include "toscalls.h" @@ -34,10 +42,37 @@ // retry this many times until it will report a failure //.text - +_bs_entry: /* main entry point, both from the floppy boot and .prg */ - bra real_entry + //bra.s skip_fat_skim + bra.s real_entry + //bra.s _bs_entry +//FAT lookalike to avoid nasty things from happening +// http://alive.atari.org/alive10/btmania.php + .ascii "Haiku0" + .byte 0xbe, 0x50, 0x38 // id + //LE + .byte 0x00, 0x02 //BPS + .byte 0x02 //SPC + //.byte 0x00 //??? + .byte 0x00, 0x02 //RES - number of reserved sectors + .byte 0x00//0x02 //NFATS + .byte 0x00/*70*/, 0x00 //NDIRS + .byte 0x00, 0x02 //NSECTS + .byte 0xf8 //MEDIA + .byte 0x05, 0x00 //SPF + .byte 0x09, 0x00 //SPT + .byte 0x02, 0x00 //NSIDES + .byte 0x00, 0x00 //NHID + // we're done +skip_fat_skim: +// lea str,%a0 +// bsr puts +// bra skip_fat_skim + //rts +// bra real_entry + sNumSectors: // this location will contain the length of the boot loader as // written by the "makeflop" command in 512 byte blocks @@ -47,6 +82,10 @@ real_entry: + //Pterm0 + //move.w #1,%d0 + //trap #1 + // first, determine if .prg (user) or bootsect (super) // Super() move.l #SUP_INQUIRE,-(%sp) @@ -59,6 +98,9 @@ //bra bootsect_start rts floppy_start: + lea str,%a0 + bsr puts + bra floppy_start // no interrupt and.w #0x0700,%sr // setup stack @@ -122,7 +164,7 @@ move.l %d0,saved_super_stack // all done lea unimpl,%a0 - jsr puts + bsr puts spin: bra spin @@ -181,12 +223,12 @@ .string "Unimplemented." shell_end: - .fill 0x01fe - tmp_floppy_end, 1, 0x55 -// .org 0x01fe + //.fill (0x01fe - shell_end), 1, 0x55 + .org 0x01fe .word 0xaa55-1 // will be replaced by the one calculated by the build. // we make sure we PCs don't try to execute it. // this bumps the "start" label to offset 0x0200 as // expected by the BFS boot loader, and also marks // this block as valid boot block for the BIOS // XXX: actually TOS wants a real checksum here so sum is 0x1234! -tmp_floppy_end: + From mmu_man at mail.berlios.de Tue Jan 15 00:14:26 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 15 Jan 2008 00:14:26 +0100 Subject: [Haiku-commits] r23526 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801142314.m0ENEQ7j025824@sheep.berlios.de> Author: mmu_man Date: 2008-01-15 00:14:26 +0100 (Tue, 15 Jan 2008) New Revision: 23526 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23526&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: * Comments on how mmu will be set up in the bootloader * Add aranym native feature helper funcs. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp 2008-01-14 21:59:44 UTC (rev 23525) +++ haiku/trunk/src/system/boot/platform/atari_m68k/mmu.cpp 2008-01-14 23:14:26 UTC (rev 23526) @@ -21,6 +21,7 @@ #include +//XXX: x86 /** The (physical) memory layout of the boot loader is currently as follows: * 0x0500 - 0x10000 protected mode stack * 0x0500 - 0x09000 real mode stack @@ -41,7 +42,36 @@ * the kernel itself (see kMaxKernelSize). */ -//#define TRACE_MMU +// notes m68k: +/** The (physical) memory layout of the boot loader is currently as follows: + * 0x0800 - 0x10000 supervisor mode stack (1) XXX: more ? x86 starts at 500 + * 0x10000 - ? code (up to ~500 kB) + * unused (TT0 instead): + * 0x90000 1st temporary page table (identity maps 0-4 MB) + * 0x91000 2nd (4-8 MB) + * + * 0x92000 - 0x92000 further page tables + * 0x100000 page directory + * ... boot loader heap (32 kB) + * ... free physical memory + * [0xa00000] end of chip RAM for TT (falcon has more till ROM) + * [0xe00000 - 0xf00000 TOS ROM] + * [0xf00000 - 0x1000000 I/O] + XXX: where is the video buffer ? + * + * The first 16 MB (2) are identity mapped (0x0 - 0x1000000); paging + * is turned on. The kernel is mapped at 0x80000000, all other stuff + * mapped by the loader (kernel args, modules, driver settings, ...) + * comes after 0x81000000 which means that there is currently only + * 1 MB reserved for the kernel itself (see kMaxKernelSize). + * + * (1) no need for user stack, we are already in supervisor mode in the + * loader. + * (2) maps the whole regular ST space; transparent translation registers + * have larger granularity anyway; + */ + +#define TRACE_MMU #ifdef TRACE_MMU # define TRACE(x) dprintf x #else @@ -60,8 +90,13 @@ static addr_t sNextPageTableAddress = 0x90000; static const uint32 kPageTableRegionEnd = 0x9e000; - // we need to reserve 2 pages for the SMP trampoline code + // we need to reserve 2 pages for the SMP trampoline code XXX:no +extern struct boot_mmu_ops k030MMUOps; +extern struct boot_mmu_ops k040MMUOps; +//extern struct boot_mmu_ops k060MMUOps; +static struct boot_mmu_ops *gMMUOps; + static addr_t get_next_virtual_address(size_t size) { @@ -260,6 +295,8 @@ { TRACE(("init_page_directory\n")); + gMMUOps->load_rp(); + gMMUOps->enable_paging(); #if 0 // allocate a new pgdir sPageDirectory = (uint32 *)get_next_physical_page(); @@ -405,6 +442,13 @@ mmu_init_for_kernel(void) { TRACE(("mmu_init_for_kernel\n")); + + + + + // remove identity mapping of ST space + gMMUOps->set_tt(0, NULL, 0, 0); + #if 0 // set up a new idt { Modified: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h 2008-01-14 21:59:44 UTC (rev 23525) +++ haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h 2008-01-14 23:14:26 UTC (rev 23526) @@ -23,8 +23,11 @@ extern void mmu_free(void *virtualAddress, size_t size); struct boot_mmu_ops { - // len=0 to disable + /* len=0 to disable */ status_t (*set_tt)(int which, addr_t pa, size_t len, uint32 perms); + /* load root pointers */ + status_t (*load_rp)(XXX); + status_t (*enable_paging)(void); }; Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-14 21:59:44 UTC (rev 23525) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-14 23:14:26 UTC (rev 23526) @@ -13,6 +13,14 @@ extern "C" { #endif +#ifndef __ASSEMBLER__ +#include +#endif + +/* + * Atari BIOS calls + */ + /* those are used by asm code too */ #define DEV_PRINTER 0 @@ -37,19 +45,8 @@ #define RW_NORETRY 0x04 #define RW_NOTRANSLATE 0x08 -#define SUP_USER 0 -#define SUP_SUPER 1 -#define SUP_SET 0 -#define SUP_INQUIRE 1 - #ifndef __ASSEMBLER__ -#include - -/* - * Atari BIOS calls - */ - extern int32 bios(uint16 nr, ...); // cf. http://www.fortunecity.com/skyscraper/apple/308/html/bios.htm @@ -92,12 +89,12 @@ return i; } +#endif /* __ASSEMBLER__ */ + /* * Atari XBIOS calls */ -extern int32 xbios(uint16 nr, ...); - #define IM_DISABLE 0 #define IM_RELATIVE 1 #define IM_ABSOLUTE 2 @@ -106,7 +103,21 @@ #define NVM_READ 0 #define NVM_WRITE 1 #define NVM_RESET 2 +// unofficial +#define NVM_R_SEC 0 +#define NVM_R_MIN 2 +#define NVM_R_HOUR 4 +#define NVM_R_MDAY 7 +#define NVM_R_MON 8 /*+- 1*/ +#define NVM_R_YEAR 9 +#define NVM_R_VIDEO 29 + +#ifndef __ASSEMBLER__ + +extern int32 xbios(uint16 nr, ...); + + #define Initmous(mode, param, vec) xbios(0, (int16)mode, (void *)param, (void *)vec) #define Physbase() (void *)xbios(2) #define Logbase() (void *)xbios(3) @@ -130,23 +141,36 @@ #define Locksnd() xbios(128) #define Unlocksnd() xbios(129) +#endif /* __ASSEMBLER__ */ + /* * Atari GEMDOS calls */ +#define SUP_USER 0 +#define SUP_SUPER 1 + + +#ifdef __ASSEMBLER__ +#define SUP_SET 0 +#define SUP_INQUIRE 1 +#else + extern int32 gemdos(uint16 nr, ...); -#undef SUP_SET -#undef SUP_INQUIRE #define SUP_SET (void *)0 #define SUP_INQUIRE (void *)1 // official names #define Pterm0() gemdos(0) #define Cconin() gemdos(1) -#define Super(a) gemdos(0x20, (uint32)a) +#define Super(s) gemdos(0x20, (uint32)s) #define Pterm(retcode) gemdos(76, (int16)retcode) +#endif /* __ASSEMBLER__ */ + +#ifdef __ASSEMBLER__ + /* * error mapping * in debug.c @@ -208,6 +232,58 @@ #endif /* __ASSEMBLER__ */ +/* + * XHDI + */ + +/* + * ARAnyM Native Features + */ + +#define NF_COOKIE 0x5f5f4e46L //'__NF' +#define NF_MAGIC 0x20021021L + +typedef struct { + long magic; + long (*nfGetID) (const char *); + long (*nfCall) (long ID, ...); +} NatFeatCookie; + +extern NatFeatCookie *gNatFeatCookie; + +static inline NatFeatCookie *nat_features(void) +{ + if (gNatFeatCookie == (void *)-1 || !gNatFeatCookie) + return NULL; + gNatFeatCookie = tos_find_cookie(NF_COOKIE); + if (!gNatFeatCookie || gNatFeatCookie->magic != NF_MAGIC) { + gNatFeatCookie = (void *)-1; + return NULL; + } + return c; +} + + +/* XHDI NatFeat */ + +#define NF_XHDI "XHDI" + +#define nfxhdi(code, a...) \ +{ \ + gNatFeatCookie->nfCall((uint32) + if (gNatFeatCookie == NULL) { + c = tos_find_cookie(NF_COOKIE); + if (!c || c->magic != NF_MAGIC) + return NULL; + return c; +} + + +#define NFXHversion() nfxhdi(0) + +#endif /* __ASSEMBLER__ */ + + #ifdef __cplusplus } #endif From stefano.ceccherini at gmail.com Tue Jan 15 11:33:10 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Tue, 15 Jan 2008 11:33:10 +0100 Subject: [Haiku-commits] r23513 - haiku/trunk/build/jam In-Reply-To: <8567456898-BeMail@laptop> References: <894b9700801140505y5f58be3k5af785c7cca0d650@mail.gmail.com> <8567456898-BeMail@laptop> Message-ID: <894b9700801150233i63dc4d88va0652b4f63ac067f@mail.gmail.com> 2008/1/14, Fran?ois Revol : > > (public) method... well, I don't know why hangman needs it, so... > > Because it needs to read the input. plain simple. I wasn't asking for a reply, I was just meaning that I don't know why it does that, nor I did research, so I couldn't fix it. > Anyway removing something because it doesn't build does not count as a > fix. > > Fran?ois. Nowhere I wrote I was "fixing" it. But since it's not a vital component and it was breaking the build, I removed it. Maybe I was too fast, but Ingo fixed it right after that, so I can't see where is the problem. From jackburton at mail.berlios.de Tue Jan 15 14:39:04 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 15 Jan 2008 14:39:04 +0100 Subject: [Haiku-commits] r23527 - haiku/trunk/src/preferences/menu Message-ID: <200801151339.m0FDd4aS001833@sheep.berlios.de> Author: jackburton Date: 2008-01-15 14:39:04 +0100 (Tue, 15 Jan 2008) New Revision: 23527 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23527&view=rev Modified: haiku/trunk/src/preferences/menu/MenuBar.cpp Log: The custom MenuBar in the menu preflet was mixing resize mode with flags.. thanks to r23424 I could notice. Modified: haiku/trunk/src/preferences/menu/MenuBar.cpp =================================================================== --- haiku/trunk/src/preferences/menu/MenuBar.cpp 2008-01-14 23:14:26 UTC (rev 23526) +++ haiku/trunk/src/preferences/menu/MenuBar.cpp 2008-01-15 13:39:04 UTC (rev 23527) @@ -22,7 +22,7 @@ MenuBar::MenuBar() - : BMenuBar(BRect(40, 10, 10, 10), "menu", B_FOLLOW_TOP | B_FRAME_EVENTS, + : BMenuBar(BRect(40, 10, 10, 10), "menu", 0, B_ITEMS_IN_COLUMN, true) { _BuildMenu(); From jackburton at mail.berlios.de Tue Jan 15 14:40:14 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 15 Jan 2008 14:40:14 +0100 Subject: [Haiku-commits] r23528 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200801151340.m0FDeDfA002055@sheep.berlios.de> Author: jackburton Date: 2008-01-15 14:40:13 +0100 (Tue, 15 Jan 2008) New Revision: 23528 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23528&view=rev Modified: haiku/trunk/headers/os/interface/Menu.h haiku/trunk/src/kits/interface/Menu.cpp Log: Menu tracking now ignores mouse movements if they are too fast (suggested by stippi). The movement threshold will be subject to changes, as I only tested on vmware and it's probably too high. Modified: haiku/trunk/headers/os/interface/Menu.h =================================================================== --- haiku/trunk/headers/os/interface/Menu.h 2008-01-15 13:39:04 UTC (rev 23527) +++ haiku/trunk/headers/os/interface/Menu.h 2008-01-15 13:40:13 UTC (rev 23528) @@ -181,7 +181,7 @@ BMenuItem* _Track(int* action, long start = -1); void _UpdateStateOpenSelect(BMenuItem* item, - bigtime_t& openTime, bigtime_t& closeTime); + bigtime_t& openTime, const int32 &mouseSpeed); void _UpdateStateClose(BMenuItem* item, const BPoint& where, const uint32& buttons); Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-15 13:39:04 UTC (rev 23527) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-15 13:40:13 UTC (rev 23528) @@ -1384,7 +1384,9 @@ } -const bigtime_t kHysteresis = 200000; // TODO: Test and reduce if needed. +const static bigtime_t kHysteresis = 200000; // TODO: Test and reduce if needed. +const static int32 kMouseMotionThreshold = 15; + // TODO: Same as above. Actually, we could get rid of the kHysteresis BMenuItem * @@ -1406,6 +1408,8 @@ UnlockLooper(); } + int32 mouseSpeed = 0; + bigtime_t pollTime = system_time(); bool releasedOnce = buttons == 0; while (fState != MENU_STATE_CLOSED) { if (_CustomTrackingWantsToQuit()) @@ -1423,7 +1427,7 @@ item = _HitTestItems(location, B_ORIGIN); if (item != NULL) { - _UpdateStateOpenSelect(item, openTime, closeTime); + _UpdateStateOpenSelect(item, openTime, mouseSpeed); if (!releasedOnce) releasedOnce = true; @@ -1477,16 +1481,33 @@ BPoint newLocation; uint32 newButtons; + + bigtime_t newPollTime = system_time(); if (LockLooper()) { GetMouse(&newLocation, &newButtons, true); - UnlockLooper(); + UnlockLooper(); } + +#if 1 + // TODO: on vmware, looks like the second system_time() could return + // a value smaller than the first call. Bug in VMWare or haiku ? + if (newPollTime <= pollTime) + newPollTime = pollTime + 100000; +#endif + //printf("newPollTime - pollTime: %lld\n", newPollTime - pollTime); + // mouseSpeed in px per ms + // (actually point_distance returns the square of the distance, + // so it's more px^2 per ms) + mouseSpeed = (int32)(point_distance(newLocation, location) * 1000 / (newPollTime - pollTime)); + pollTime = newPollTime; + //printf("mouseSpeed = %ld\n", mouseSpeed); + if (newLocation != location || newButtons != buttons) { if (!releasedOnce && newButtons == 0 && buttons != 0) releasedOnce = true; location = newLocation; - buttons = newButtons; + buttons = newButtons; } if (releasedOnce) @@ -1511,21 +1532,24 @@ void BMenu::_UpdateStateOpenSelect(BMenuItem* item, bigtime_t& openTime, - bigtime_t& closeTime) + const int32 &mouseSpeed) { if (fState == MENU_STATE_CLOSED) return; - if (item != fSelected && system_time() > closeTime + kHysteresis) { - _SelectItem(item, false); - openTime = system_time(); + if (item != fSelected) { + if (mouseSpeed < kMouseMotionThreshold) { + _SelectItem(item, false); + openTime = system_time(); + } else { + //printf("Mouse moving too fast (%ld), ignoring...\n", mouseSpeed); + } } else if (system_time() > kHysteresis + openTime && item->Submenu() != NULL && item->Submenu()->Window() == NULL) { // Open the submenu if it's not opened yet, but only if // the mouse pointer stayed over there for some time // (hysteresis) _SelectItem(item); - closeTime = system_time(); } if (fState != MENU_STATE_TRACKING) fState = MENU_STATE_TRACKING; From jackburton at mail.berlios.de Tue Jan 15 14:41:09 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 15 Jan 2008 14:41:09 +0100 Subject: [Haiku-commits] r23529 - haiku/trunk/src/kits/interface Message-ID: <200801151341.m0FDf9pR002193@sheep.berlios.de> Author: jackburton Date: 2008-01-15 14:41:08 +0100 (Tue, 15 Jan 2008) New Revision: 23529 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23529&view=rev Modified: haiku/trunk/src/kits/interface/Menu.cpp Log: Reduced the time used for the vmware workaround Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-01-15 13:40:13 UTC (rev 23528) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-01-15 13:41:08 UTC (rev 23529) @@ -1492,7 +1492,7 @@ // TODO: on vmware, looks like the second system_time() could return // a value smaller than the first call. Bug in VMWare or haiku ? if (newPollTime <= pollTime) - newPollTime = pollTime + 100000; + newPollTime = pollTime + 5000; #endif //printf("newPollTime - pollTime: %lld\n", newPollTime - pollTime); // mouseSpeed in px per ms From mmu_man at mail.berlios.de Tue Jan 15 16:00:00 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 15 Jan 2008 16:00:00 +0100 Subject: [Haiku-commits] r23530 - haiku/trunk/src/system/ldscripts/m68k Message-ID: <200801151500.m0FF00QS008505@sheep.berlios.de> Author: mmu_man Date: 2008-01-15 16:00:00 +0100 (Tue, 15 Jan 2008) New Revision: 23530 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23530&view=rev Modified: haiku/trunk/src/system/ldscripts/m68k/boot_loader_atari_m68k.ld Log: Our ld script is actually closer to the x86 one... this should work. Modified: haiku/trunk/src/system/ldscripts/m68k/boot_loader_atari_m68k.ld =================================================================== --- haiku/trunk/src/system/ldscripts/m68k/boot_loader_atari_m68k.ld 2008-01-15 13:41:08 UTC (rev 23529) +++ haiku/trunk/src/system/ldscripts/m68k/boot_loader_atari_m68k.ld 2008-01-15 15:00:00 UTC (rev 23530) @@ -2,44 +2,33 @@ OUTPUT_ARCH(m68k) ENTRY(_start) - SECTIONS { - . = 0x102000 + SIZEOF_HEADERS; + //. = 0x10000; + . = 0x00080000; - __text_begin = .; - /* text/read-only data */ .text : { *(.text .gnu.linkonce.t.*) } - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - .sdata2 : { *(.sdata2) } - - /* writable data */ - /* align to the same offset in the next page (for performance reasons - (not that it really matters in the boot loader)) */ - . = ALIGN(0x1000) + 0x1000 + (. & (0x1000 - 1)); - + . = ALIGN(0x4); __ctor_list = .; .ctors : { *(.ctors) } __ctor_end = .; + .rodata : { *(.rodata .rodata.*) } + + /* writable data */ + . = ALIGN(0x1000); __data_start = .; .data : { *(.data .gnu.linkonce.d.*) } - .data.rel.ro : { *(.data.rel.ro.local .data.rel.ro*) } - .got : { *(.got .got2) } - .sdata : { *(.sdata .sdata.* .gnu.linkonce.s.*) } /* unintialized data (in same segment as writable data) */ __bss_start = .; - .sbss : { *(.sbss .sbss.* .gnu.linkonce.sb.*) } - .bss : { - *(.bss .bss.* .gnu.linkonce.b.*) - . = ALIGN(0x1000); - } + .bss : { *(.bss) } + . = ALIGN(0x1000); _end = . ; /* Strip unnecessary stuff */ - /DISCARD/ : { *(.comment .note .eh_frame .dtors .debug_*) } + /DISCARD/ : { *(.comment .note .eh_frame .dtors .stab .stabstr .debug*) } } From mmu_man at mail.berlios.de Tue Jan 15 16:02:26 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 15 Jan 2008 16:02:26 +0100 Subject: [Haiku-commits] r23531 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801151502.m0FF2Q2N008856@sheep.berlios.de> Author: mmu_man Date: 2008-01-15 16:02:26 +0100 (Tue, 15 Jan 2008) New Revision: 23531 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23531&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/atari_memory_map.h haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h haiku/trunk/src/system/boot/platform/atari_m68k/shell.S haiku/trunk/src/system/boot/platform/atari_m68k/start.c haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: * Fixes * More test code * it actually runs now, till _start. However, calling TOS from C is broken: we use 32 bit param alignment on funcs, but TOS expects 16 bit... need to use asm macros instead of funcs. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/atari_memory_map.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/atari_memory_map.h 2008-01-15 15:00:00 UTC (rev 23530) +++ haiku/trunk/src/system/boot/platform/atari_m68k/atari_memory_map.h 2008-01-15 15:02:26 UTC (rev 23531) @@ -21,7 +21,7 @@ #define ATARI_SHADOW_BASE 0xff000000 /* how we will use it */ -#define ATARI_ZBEOS_STACK_BASE 0x00008000 -#define ATARI_ZBEOS_BASE 0x00010000 /* from .prg shell.S will copy itself there */ +#define ATARI_ZBEOS_STACK_BASE 0x00040000 +#define ATARI_ZBEOS_BASE 0x00080000 /* from .prg shell.S will copy itself there */ #endif /* ATARI_MEMORY_MAP_H */ Modified: haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c 2008-01-15 15:00:00 UTC (rev 23530) +++ haiku/trunk/src/system/boot/platform/atari_m68k/fixup_tos_floppy_chksum.c 2008-01-15 15:02:26 UTC (rev 23531) @@ -23,7 +23,7 @@ v += *p++; sum += v; } - sum = 0x1234 - sum + 1; + sum = 0x1234 - sum /*+ 1*/; //sum = 0xaa55; // big endian *p++ = (uint8_t)(sum >> 8); Modified: haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h 2008-01-15 15:00:00 UTC (rev 23530) +++ haiku/trunk/src/system/boot/platform/atari_m68k/mmu.h 2008-01-15 15:02:26 UTC (rev 23531) @@ -26,7 +26,7 @@ /* len=0 to disable */ status_t (*set_tt)(int which, addr_t pa, size_t len, uint32 perms); /* load root pointers */ - status_t (*load_rp)(XXX); + status_t (*load_rp)(void/*XXX*/); status_t (*enable_paging)(void); }; Modified: haiku/trunk/src/system/boot/platform/atari_m68k/shell.S =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-15 15:00:00 UTC (rev 23530) +++ haiku/trunk/src/system/boot/platform/atari_m68k/shell.S 2008-01-15 15:02:26 UTC (rev 23531) @@ -81,30 +81,57 @@ .word 0x0180 real_entry: + lea h1,%a0 + bsr puts + move.l #0x1234aa55,%d0 + bsr putx + + //_membot + move.l #0x432,%a0 + move.l (%a0),%d0 + bsr putx + + //_memtop + move.l #0x436,%a0 + move.l (%a0),%d0 + bsr putx + + //_v_bas_ad + move.l #0x44e,%a0 + move.l (%a0),%d0 + bsr putx + + //Pterm0 - //move.w #1,%d0 + //move.w #0,-(%sp) //trap #1 // first, determine if .prg (user) or bootsect (super) // Super() move.l #SUP_INQUIRE,-(%sp) - move.w #0x20,%d0 + move.w #0x20,-(%sp) trap #1 addq.l #6,%sp - cmp.w #SUP_SUPER,%d0 - beq floppy_start + + bsr putx + + cmp.l #SUP_USER,%d0 + bne floppy_start + lea h2,%a0 + bsr puts + bra prg_start //bra bootsect_start rts floppy_start: + lea h3,%a0 + bsr puts lea str,%a0 bsr puts - bra floppy_start + //bra floppy_start // no interrupt - and.w #0x0700,%sr - // setup stack - move.l #ATARI_ZBEOS_STACK_BASE,%sp + or.w #0x0700,%sr //XXX: check for enough RAM // load the rest move.w sNumSectors,%d2 @@ -117,7 +144,14 @@ bsr puts bra spin floppy_done: - jmp ATARI_ZBEOS_BASE+512 + lea h4,%a0 + bsr puts + // setup stack + move.l #ATARI_ZBEOS_STACK_BASE,%sp + lea h5,%a0 + bsr puts + //jmp ATARI_ZBEOS_BASE+512 + jmp _start //rts @@ -136,12 +170,13 @@ move.w #4,-(%sp) trap #13 add.l #14,%sp + bsr putx rts floppy_end: // .org FAILURE_STRING failure_string: - .string " Loading failed! Press key to reboot.\r\n" +// .string " Loading failed! Press key to reboot.\r\n" // .org DOT_STRING .string "." @@ -155,22 +190,49 @@ // this block as valid boot block for the BIOS prg_start: + lea h4,%a0 + bsr puts +#if 0 // .prg: // we need to switch to supervisor mode anyway move.l #SUP_SET,-(%sp) - move.w #0x20,%d0 + move.w #0x20,-(%sp) trap #1 addq.l #6,%sp move.l %d0,saved_super_stack + + lea h5,%a0 + bsr puts + //Pterm0 + move.w #0,-(%sp) + trap #1 + + // copy the rest of the prg + move.l sNumSectors,%d0 + sub.l #1,%d0 + lea _bs_entry,%a0 + move.l #ATARI_ZBEOS_BASE,%a1 + +nextsect: + move.l #512/4-1,%d1 +copysect_loop: + move.l (%a0)+,(%a1)+ + dbf %d1,copysect_loop + dbf %d0,nextsect +#endif + + lea str,%a0 + bsr puts // all done +spin: lea unimpl,%a0 bsr puts -spin: bra spin super_done: // XXX: copy the rest ! - jmp ATARI_ZBEOS_BASE+512 + //jmp ATARI_ZBEOS_BASE+512 + jmp _start saved_super_stack: .long 0 @@ -186,6 +248,33 @@ +putx: + movem.l %d0-%d2/%a0-%a2,-(%sp) + move.l #8-1,%d2 + move.l %d0,%d1 +putxloop: + move.l %d1,%d0 + lsl.l #4,%d1 + //swap %d0 + //lsr.l #8,%d0 + //lsr.l #4,%d0 + rol.l #4,%d0 + and.l #0x0f,%d0 + cmp.b #9,%d0 + ble putx0 + add.b #'a'-'0'-10,%d0 + //bra putxdisp +putx0: + add.b #'0',%d0 +putxdisp: + bsr putc + dbf %d2,putxloop + move.b #'\r',%d0 + bsr putc + move.b #'\n',%d0 + bsr putc + movem.l (%sp)+,%d0-%d2/%a0-%a2 + rts lea.l str,%a0 puts: @@ -195,10 +284,10 @@ bsr putc bra .loopt .strout: - //Pterm0 - move.w #1,%d0 - trap #1 - + move.b #'\r',%d0 + bsr putc + move.b #'\n',%d0 + bsr putc rts .loop: @@ -207,21 +296,34 @@ bra .loop rts + /* prints the char in d0.b to the console */ putc: - movem.l %a0,-(%sp) + movem.l %d0-%d2/%a0-%a2,-(%sp) move.w %d0,-(%sp) move.w #DEV_CON,-(%sp) // DEV_CON move.w #3,-(%sp) // Bconout trap #13 add.l #6,%sp - movem.l (%sp)+,%a0 + movem.l (%sp)+,%d0-%d2/%a0-%a2 rts + str: .string "Haiku!" +h1: + .string "H1" +h2: + .string "H2" +h3: + .string "H3" +h4: + .string "H4" +h5: + .string "H5" unimpl: .string "Unimplemented." + shell_end: //.fill (0x01fe - shell_end), 1, 0x55 .org 0x01fe Modified: haiku/trunk/src/system/boot/platform/atari_m68k/start.c =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/start.c 2008-01-15 15:00:00 UTC (rev 23530) +++ haiku/trunk/src/system/boot/platform/atari_m68k/start.c 2008-01-15 15:02:26 UTC (rev 23531) @@ -108,7 +108,13 @@ _start(void) { stage2_args args; + Bconout(DEV_CON, 'h'); + Bconout(DEV_CON, 'A'); + Bconout(DEV_CON, 'I'); + Bconout(DEV_CON, 'K'); + Bconout(DEV_CON, 'U'); + //asm("cld"); // Ain't nothing but a GCC thang. //asm("fninit"); // initialize floating point unit Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-15 15:00:00 UTC (rev 23530) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-15 15:02:26 UTC (rev 23531) @@ -15,8 +15,9 @@ #ifndef __ASSEMBLER__ #include -#endif +#endif /* __ASSEMBLER__ */ + /* * Atari BIOS calls */ @@ -169,7 +170,7 @@ #endif /* __ASSEMBLER__ */ -#ifdef __ASSEMBLER__ +#ifndef __ASSEMBLER__ /* * error mapping @@ -243,6 +244,8 @@ #define NF_COOKIE 0x5f5f4e46L //'__NF' #define NF_MAGIC 0x20021021L +#ifndef __ASSEMBLER__ + typedef struct { long magic; long (*nfGetID) (const char *); @@ -253,14 +256,18 @@ static inline NatFeatCookie *nat_features(void) { + const struct tos_cookie *c; if (gNatFeatCookie == (void *)-1 || !gNatFeatCookie) return NULL; - gNatFeatCookie = tos_find_cookie(NF_COOKIE); - if (!gNatFeatCookie || gNatFeatCookie->magic != NF_MAGIC) { - gNatFeatCookie = (void *)-1; - return NULL; + c = tos_find_cookie(NF_COOKIE); + if (c) { + gNatFeatCookie = (NatFeatCookie *)c->pvalue; + if (gNatFeatCookie && gNatFeatCookie->magic == NF_MAGIC) { + return gNatFeatCookie; + } } - return c; + gNatFeatCookie = (NatFeatCookie *)-1; + return NULL; } @@ -269,21 +276,15 @@ #define NF_XHDI "XHDI" #define nfxhdi(code, a...) \ -{ \ - gNatFeatCookie->nfCall((uint32) - if (gNatFeatCookie == NULL) { - c = tos_find_cookie(NF_COOKIE); - if (!c || c->magic != NF_MAGIC) - return NULL; - return c; -} +({ \ + gNatFeatCookie->nfCall((uint32)code, a##...); \ +}) #define NFXHversion() nfxhdi(0) #endif /* __ASSEMBLER__ */ - #ifdef __cplusplus } #endif From axeld at mail.berlios.de Tue Jan 15 16:04:31 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 15 Jan 2008 16:04:31 +0100 Subject: [Haiku-commits] r23532 - haiku/trunk/src/system/kernel/cache Message-ID: <200801151504.m0FF4VVI008965@sheep.berlios.de> Author: axeld Date: 2008-01-15 16:04:31 +0100 (Tue, 15 Jan 2008) New Revision: 23532 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23532&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: * Added tracing support for transactions. * improved the "block_cache" KDL command: it can now also dump blocks, added support for the "--help" argument. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-01-15 15:02:26 UTC (rev 23531) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-01-15 15:04:31 UTC (rev 23532) @@ -48,43 +48,137 @@ // system, like out of memory situations - should only panic for debugging. #define FATAL(x) panic x + +struct cache_hook : DoublyLinkedListLinkImpl { + transaction_notification_hook hook; + void *data; +}; + +typedef DoublyLinkedList HookList; + +struct cache_transaction { + cache_transaction(); + + cache_transaction *next; + int32 id; + int32 num_blocks; + int32 sub_num_blocks; + cached_block *first_block; + block_list blocks; + transaction_notification_hook notification_hook; + void *notification_data; + HookList listeners; + bool open; + bool has_sub_transaction; +}; + #ifdef TRANSACTION_TRACING namespace TransactionTracing { class Start : public AbstractTraceEntry { public: - Start(cache_transaction *transaction) + Start(block_cache *cache, cache_transaction *transaction) : - fTransaction(transaction) + fCache(cache), + fTransaction(transaction), + fID(transaction->id), + fSub(transaction->has_sub_transaction), + fNumBlocks(transaction->num_blocks), + fSubNumBlocks(transaction->sub_num_blocks) { Initialized(); } virtual void AddDump(char *buffer, size_t size) { + snprintf(buffer, size, "cache %p, start transaction %p (id %ld)%s" + ", %ld/%ld blocks", fCache, fTransaction, fID, + fSub ? " sub" : "", fNumBlocks, fSubNumBlocks); } private: + block_cache *fCache; cache_transaction *fTransaction; + int32 fID; + bool fSub; + int32 fNumBlocks; + int32 fSubNumBlocks; }; -class Cancel : public AbstractTraceEntry { +class Detach : public AbstractTraceEntry { public: - Cancel(cache_transaction *transaction) + Detach(block_cache *cache, cache_transaction *transaction, + cache_transaction *newTransaction) : - fTransaction(transaction) + fCache(cache), + fTransaction(transaction), + fID(transaction->id), + fSub(transaction->has_sub_transaction), + fNewTransaction(newTransaction), + fNewID(newTransaction->id) { Initialized(); } virtual void AddDump(char *buffer, size_t size) { + snprintf(buffer, size, "cache %p, detach transaction %p (id %ld)" + "from transaction %p (id %ld)%s", + fCache, fNewTransaction, fNewID, fTransaction, fID, + fSub ? " sub" : ""); } private: + block_cache *fCache; cache_transaction *fTransaction; + int32 fID; + bool fSub; + cache_transaction *fNewTransaction; + int32 fNewID; }; +class Abort : public AbstractTraceEntry { + public: + Abort(block_cache *cache, cache_transaction *transaction) + : + fCache(cache), + fTransaction(transaction), + fID(transaction->id), + fNumBlocks(0) + { + bool isSub = transaction->has_sub_transaction; + fNumBlocks = isSub ? transaction->sub_num_blocks + : transaction->num_blocks; + fBlocks = (off_t *)alloc_tracing_buffer(fNumBlocks * sizeof(off_t)); + if (fBlocks != NULL) { + cached_block *block = transaction->first_block; + for (int32 i = 0; block != NULL && i < fNumBlocks; + block = block->transaction_next) { + fBlocks[i++] = block->block_number; + } + } else + fNumBlocks = 0; + Initialized(); + } + + virtual void AddDump(char *buffer, size_t size) + { + int length = snprintf(buffer, size, "cache %p, abort transaction " + "%p (id %ld), blocks", fCache, fTransaction, fID); + for (int32 i = 0; i < fNumBlocks && (size_t)length < size; i++) { + length += snprintf(buffer + length, size - length, " %Ld", + fBlocks[i]); + } + } + + private: + block_cache *fCache; + cache_transaction *fTransaction; + int32 fID; + off_t *fBlocks; + int32 fNumBlocks; +}; + } // namespace TransactionTracing # define T(x) new(std::nothrow) TransactionTracing::x; @@ -93,29 +187,6 @@ #endif -struct cache_hook : DoublyLinkedListLinkImpl { - transaction_notification_hook hook; - void *data; -}; - -typedef DoublyLinkedList HookList; - -struct cache_transaction { - cache_transaction(); - - cache_transaction *next; - int32 id; - int32 num_blocks; - int32 sub_num_blocks; - cached_block *first_block; - block_list blocks; - transaction_notification_hook notification_hook; - void *notification_data; - HookList listeners; - bool open; - bool has_sub_transaction; -}; - static status_t write_cached_block(block_cache *cache, cached_block *block, bool deleteTransaction = true); @@ -804,8 +875,8 @@ static int dump_cache(int argc, char **argv) { - if (argc < 2) { - kprintf("usage: %s [-b]
\n", argv[0]); + if (argc < 2 || !strcmp(argv[1], "--help")) { + kprintf("usage: %s [-b]
[block-number]\n", argv[0]); return 0; } @@ -816,12 +887,52 @@ i++; } - block_cache *cache = (struct block_cache *)strtoul(argv[i], NULL, 0); + block_cache *cache = (struct block_cache *)parse_expression(argv[i]); if (cache == NULL) { kprintf("invalid cache address\n"); return 0; } + off_t blockNumber = -1; + if (i + 1 < argc) { + blockNumber = strtoll(argv[i + 1], NULL, 0); + cached_block *block = (cached_block *)hash_lookup(cache->hash, + &blockNumber); + if (cache != NULL) { + kprintf("BLOCK %p\n", block); + kprintf(" current data: %p\n", block->current_data); + kprintf(" original data: %p\n", block->original_data); + kprintf(" parent data: %p\n", block->parent_data); + kprintf(" ref_count: %ld\n", block->ref_count); + kprintf(" accessed: %ld\n", block->accessed); + kprintf(" flags: "); + if (block->is_writing) + kprintf(" is-writing"); + if (block->is_dirty) + kprintf(" is-dirty"); + if (block->unused) + kprintf(" unused"); + if (block->unmapped) + kprintf(" unmapped"); + kprintf("\n"); + if (block->transaction != NULL) { + kprintf(" transaction: %p (%ld)\n", block->transaction, + block->transaction->id); + if (block->transaction_next != NULL) { + kprintf(" next in transaction: %Ld\n", + block->transaction_next->block_number); + } + } + if (block->previous_transaction != NULL) { + kprintf(" previous transaction: %p (%ld)\n", + block->previous_transaction, + block->previous_transaction->id); + } + } else + kprintf("block %Ld not found\n", blockNumber); + return 0; + } + kprintf("BLOCK CACHE: %p\n", cache); kprintf(" fd: %d\n", cache->fd); @@ -914,6 +1025,7 @@ cache->last_transaction = transaction; TRACE(("cache_start_transaction(): id %ld started\n", transaction->id)); + T(Start(cache, transaction)); hash_insert(cache->transaction_hash, transaction); @@ -1024,6 +1136,7 @@ return B_BAD_VALUE; } + T(Abort(cache, transaction)); notify_transaction_listeners(transaction, TRANSACTION_ABORTED); // iterate through all blocks and restore their original contents @@ -1083,6 +1196,7 @@ return B_NO_MEMORY; newTransaction->id = atomic_add(&cache->next_transaction_id, 1); + T(Detach(cache, transaction, newTransaction)); transaction->notification_hook = hook; transaction->notification_data = data; @@ -1153,6 +1267,7 @@ if (!transaction->has_sub_transaction) return B_BAD_VALUE; + T(Abort(cache, transaction)); notify_transaction_listeners(transaction, TRANSACTION_ABORTED); // revert all changes back to the version of the parent @@ -1223,6 +1338,7 @@ // all subsequent changes will go into the sub transaction transaction->has_sub_transaction = true; transaction->sub_num_blocks = 0; + T(Start(cache, transaction)); return B_OK; } From axeld at mail.berlios.de Tue Jan 15 16:06:15 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 15 Jan 2008 16:06:15 +0100 Subject: [Haiku-commits] r23533 - haiku/trunk/src/system/kernel/debug Message-ID: <200801151506.m0FF6FXL009144@sheep.berlios.de> Author: axeld Date: 2008-01-15 16:06:15 +0100 (Tue, 15 Jan 2008) New Revision: 23533 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23533&view=rev Modified: haiku/trunk/src/system/kernel/debug/tracing.cpp Log: * "traced" now always prints the index numbers (before, it only did that when a pattern was involved). * alloc_tracing_buffer() no longer allocates anything when you ask for a zero byte buffer. * Fixed warning. Modified: haiku/trunk/src/system/kernel/debug/tracing.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/tracing.cpp 2008-01-15 15:04:31 UTC (rev 23532) +++ haiku/trunk/src/system/kernel/debug/tracing.cpp 2008-01-15 15:06:15 UTC (rev 23533) @@ -201,7 +201,7 @@ if (start < 0) start = 0; - if (start + count > sEntries) + if (uint32(start + count) > sEntries) count = sEntries - start; int32 index = 0; @@ -229,10 +229,7 @@ dumped++; - if (pattern != NULL) - kprintf("%5ld. %s\n", index, buffer); - else - kprintf("%s\n", buffer); + kprintf("%5ld. %s\n", index, buffer); } else kprintf("%5ld. ** uninitialized entry **\n", index); } @@ -249,6 +246,9 @@ extern "C" uint8* alloc_tracing_buffer(size_t size) { + if (size == 0) + return NULL; + #if ENABLE_TRACING trace_entry* entry = allocate_entry(size + sizeof(trace_entry)); if (entry == NULL) From axeld at mail.berlios.de Tue Jan 15 16:18:02 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 15 Jan 2008 16:18:02 +0100 Subject: [Haiku-commits] r23534 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200801151518.m0FFI2Sk009923@sheep.berlios.de> Author: axeld Date: 2008-01-15 16:18:02 +0100 (Tue, 15 Jan 2008) New Revision: 23534 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23534&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.h Log: * Fixed bug in the BlockAllocator::Allocate() function which did not compute the bit offsets correctly if the last block of the whole bitmap was only a partial block. * Added new bfs_allocator KDL command. * Renamed the KDL command bfsinode to bfs_inode. * Added "--help" argument to bfs_inode and bfs KDL commands. * Added more tracing in the block allocator. * Turned on the ASSERT() macro in non-debug builds. * Minor cleanup. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-01-15 15:06:15 UTC (rev 23533) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-01-15 15:18:02 UTC (rev 23534) @@ -95,10 +95,12 @@ class Block : public AbstractTraceEntry { public: Block(const char *label, off_t blockNumber, const uint8 *data, - size_t size) + size_t size, uint32 start = 0, uint32 length = 0) : fBlock(blockNumber), - fData(data) + fData(data), + fStart(start), + fLength(length) { strlcpy(fLabel, label, sizeof(fLabel)); fSum = checksum(data, size); @@ -109,7 +111,8 @@ virtual void AddDump(char *buffer, size_t size) { uint32 length = snprintf(buffer, size, "%s: block %Ld (%p), sum %lu," - " bytes ", fLabel, fBlock, fData, fSum); + " s/l %lu/%lu, bytes ", fLabel, fBlock, fData, fSum, fStart, + fLength); for (uint32 i = 0; length < size - 1 && i < sizeof(fBytes); i++) { length += snprintf(buffer + length, size - length, "%02x", fBytes[i]); @@ -119,6 +122,8 @@ private: off_t fBlock; const uint8 *fData; + uint32 fStart; + uint32 fLength; uint32 fSum; char fLabel[12]; uint8 fBytes[32]; @@ -215,7 +220,8 @@ status_t -AllocationBlock::SetToWritable(Transaction &transaction, AllocationGroup &group, uint16 block) +AllocationBlock::SetToWritable(Transaction &transaction, AllocationGroup &group, + uint16 block) { // 8 blocks per byte fNumBits = fVolume->BlockSize() << 3; @@ -226,8 +232,8 @@ #ifdef DEBUG fWritable = true; #endif - return CachedBlock::SetToWritable(transaction, group.Start() + block) != NULL - ? B_OK : B_ERROR; + return CachedBlock::SetToWritable(transaction, group.Start() + block) + != NULL ? B_OK : B_ERROR; } @@ -256,13 +262,15 @@ DIE(("Allocation::Allocate(): tried to allocate too many blocks")); } + T(Block("b-alloc-in", fBlockNumber, fBlock, fVolume->BlockSize(), + start, numBlocks)); + int32 block = start >> 5; while (numBlocks > 0) { uint32 mask = 0; for (int32 i = start % 32; i < 32 && numBlocks; i++, numBlocks--) - mask |= 1UL << (i % 32); - + mask |= 1UL << i; #ifdef DEBUG // check for already set blocks if (HOST_ENDIAN_TO_BFS_INT32(mask) & ((uint32 *)fBlock)[block]) { @@ -273,6 +281,8 @@ Block(block++) |= HOST_ENDIAN_TO_BFS_INT32(mask); start = 0; } + T(Block("b-alloc-out", fBlockNumber, fBlock, fVolume->BlockSize(), + start, numBlocks)); } @@ -306,11 +316,10 @@ // #pragma mark - -/** The allocation groups are created and initialized in - * BlockAllocator::Initialize() and BlockAllocator::InitializeAndClearBitmap() - * respectively. - */ - +/*! The allocation groups are created and initialized in + BlockAllocator::Initialize() and BlockAllocator::InitializeAndClearBitmap() + respectively. +*/ AllocationGroup::AllocationGroup() : fFirstFree(-1), @@ -339,15 +348,12 @@ } -/** Allocates the specified run in the allocation group. - * Doesn't check if the run is valid or already allocated - * partially, nor does it maintain the free ranges hints - * or the volume's used blocks count. - * It only does the low-level work of allocating some bits - * in the block bitmap. - * Assumes that the block bitmap lock is hold. - */ - +/*! Allocates the specified run in the allocation group. + Doesn't check if the run is valid or already allocated partially, nor + does it maintain the free ranges hints or the volume's used blocks count. + It only does the low-level work of allocating some bits in the block bitmap. + Assumes that the block bitmap lock is hold. +*/ status_t AllocationGroup::Allocate(Transaction &transaction, uint16 start, int32 length) { @@ -389,15 +395,12 @@ } -/** Frees the specified run in the allocation group. - * Doesn't check if the run is valid or was not completely - * allocated, nor does it maintain the free ranges hints - * or the volume's used blocks count. - * It only does the low-level work of freeing some bits - * in the block bitmap. - * Assumes that the block bitmap lock is hold. - */ - +/*! Frees the specified run in the allocation group. + Doesn't check if the run is valid or was not completely allocated, nor + does it maintain the free ranges hints or the volume's used blocks count. + It only does the low-level work of freeing some bits in the block bitmap. + Assumes that the block bitmap lock is hold. +*/ status_t AllocationGroup::Free(Transaction &transaction, uint16 start, int32 length) { @@ -642,10 +645,11 @@ AllocationBlock cached(fVolume); Locker lock(fLock); - // the first scan through all allocation groups will look for the + // The first scan through all allocation groups will look for the // wanted maximum of blocks, the second scan will just look to // satisfy the minimal requirement uint16 numBlocks = maximum; + uint32 bitsPerFullBlock = fVolume->BlockSize() << 3; for (int32 i = 0; i < fNumGroups * 2; i++, group++, start = 0) { group = group % fNumGroups; @@ -654,7 +658,7 @@ continue; if (i >= fNumGroups) { - // if the minimum is the same as the maximum, it's not necessary to + // If the minimum is the same as the maximum, it's not necessary to // search for in the allocation groups a second time if (maximum == minimum) return B_DEVICE_FULL; @@ -662,8 +666,8 @@ numBlocks = minimum; } - // The wanted maximum is smaller than the largest free block in the group - // or already smaller than the minimum + // The wanted maximum is smaller than the largest free block in the + // group or already smaller than the minimum // ToDo: disabled because it's currently not maintained after the first allocation //if (numBlocks > fGroups[group].fLargest) // continue; @@ -671,7 +675,7 @@ if (start < fGroups[group].fFirstFree) start = fGroups[group].fFirstFree; - // there may be more than one block per allocation group - and + // There may be more than one block per allocation group - and // we iterate through it to find a place for the allocation. // (one allocation can't exceed one allocation group) @@ -682,15 +686,15 @@ if (cached.SetTo(fGroups[group], block) < B_OK) RETURN_ERROR(B_ERROR); - T(Block("alloc-in", block, cached.Block(), fVolume->BlockSize())); + T(Block("alloc-in", fGroups[group].Start() + block, cached.Block(), fVolume->BlockSize(), group, rangeStart)); // find a block large enough to hold the allocation - for (uint32 bit = start % cached.NumBlockBits(); + for (uint32 bit = start % bitsPerFullBlock; bit < cached.NumBlockBits(); bit++) { if (!cached.IsUsed(bit)) { if (range == 0) { // start new range - rangeStart = block * cached.NumBlockBits() + bit; + rangeStart = block * bitsPerFullBlock + bit; } // have we found a range large enough to hold numBlocks? @@ -733,7 +737,7 @@ T(Allocate(run)); T(Block("alloc-out", block, cached.Block(), - fVolume->BlockSize())); + fVolume->BlockSize(), group, rangeStart)); return B_OK; } @@ -746,8 +750,8 @@ status_t -BlockAllocator::AllocateForInode(Transaction &transaction, const block_run *parent, - mode_t type, block_run &run) +BlockAllocator::AllocateForInode(Transaction &transaction, + const block_run *parent, mode_t type, block_run &run) { // apply some allocation policies here (AllocateBlocks() will break them // if necessary) - we will start with those described in Dominic Giampaolo's @@ -1407,3 +1411,48 @@ return B_OK; } + +// #pragma mark - debugger commands + + +#ifdef BFS_DEBUGGER_COMMANDS + + +void +BlockAllocator::Dump() +{ + kprintf("allocation groups: %ld\n", fNumGroups); + kprintf("blocks per group: %ld\n", fBlocksPerGroup); + + for (int32 i = 0; i < fNumGroups; i++) { + AllocationGroup& group = fGroups[i]; + + kprintf("[%3ld] num bits: %lu\n", i, group.NumBits()); + kprintf(" num blocks: %lu\n", group.NumBlocks()); + kprintf(" start: %ld\n", group.Start()); + kprintf(" first free: %ld\n", group.fFirstFree); + kprintf(" largest: %ld\n", group.fLargest); + kprintf(" largest first: %ld\n", group.fLargestFirst); + kprintf(" free bits: %ld\n", group.fFreeBits); + } +} + + +int +dump_block_allocator(int argc, char **argv) +{ + if (argc != 2 || !strcmp(argv[1], "--help")) { + kprintf("usage: %s \n", argv[0]); + return 0; + } + + Volume *volume = (Volume *)parse_expression(argv[1]); + BlockAllocator &allocator = volume->Allocator(); + + allocator.Dump(); + return 0; +} + + +#endif // BFS_DEBUGGER_COMMANDS + Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h 2008-01-15 15:06:15 UTC (rev 23533) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h 2008-01-15 15:18:02 UTC (rev 23534) @@ -1,6 +1,5 @@ -/* BlockAllocator - block bitmap handling and allocation policies - * - * Copyright 2001-2006, Axel D?rfler, axeld at pinc-software.de. +/* + * Copyright 2001-2008, Axel D?rfler, axeld at pinc-software.de. * This file may be used under the terms of the MIT License. */ #ifndef BLOCK_ALLOCATOR_H @@ -46,6 +45,10 @@ size_t BitmapSize() const; +#ifdef BFS_DEBUGGER_COMMANDS + void Dump(); +#endif + private: bool _IsValidCheckControl(check_control *control); bool _CheckBitmapIsUsedAt(off_t block) const; @@ -63,4 +66,8 @@ check_cookie *fCheckCookie; }; +#ifdef BFS_DEBUGGER_COMMANDS +int dump_block_allocator(int argc, char **argv); +#endif + #endif /* BLOCK_ALLOCATOR_H */ Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp 2008-01-15 15:06:15 UTC (rev 23533) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp 2008-01-15 15:18:02 UTC (rev 23534) @@ -7,6 +7,7 @@ #include "Debug.h" +#include "BlockAllocator.h" #include "BPlusTree.h" #include "Inode.h" @@ -247,7 +248,7 @@ static int dump_inode(int argc, char **argv) { - if (argc != 2) { + if (argc != 2 || !strcmp(argv[1], "--help")) { kprintf("usage: bfsinode \n"); return 0; } @@ -262,7 +263,7 @@ static int dump_volume(int argc, char **argv) { - if (argc != 2) { + if (argc != 2 || !strcmp(argv[1], "--help")) { kprintf("usage: bfs \n"); return 0; } @@ -281,7 +282,8 @@ void remove_debugger_commands() { - remove_debugger_command("bfsinode", dump_inode); + remove_debugger_command("bfs_inode", dump_inode); + remove_debugger_command("bfs_allocator", dump_block_allocator); remove_debugger_command("bfs", dump_volume); } @@ -289,7 +291,9 @@ void add_debugger_commands() { - add_debugger_command("bfsinode", dump_inode, "dump an Inode object"); + add_debugger_command("bfs_inode", dump_inode, "dump an Inode object"); + add_debugger_command("bfs_allocator", dump_block_allocator, + "dump a BFS block allocator."); add_debugger_command("bfs", dump_volume, "dump a BFS volume"); } Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.h 2008-01-15 15:06:15 UTC (rev 23533) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.h 2008-01-15 15:18:02 UTC (rev 23534) @@ -74,7 +74,8 @@ #define FUNCTION_START(x) ; #define D(x) ; #ifndef ASSERT - # define ASSERT(x) ; + # define ASSERT(x) { if (!(x)) DEBUGGER(("bfs: assert failed: " #x "\n")); } +// # define ASSERT(x) ; #endif #endif From mmu_man at mail.berlios.de Tue Jan 15 17:12:39 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 15 Jan 2008 17:12:39 +0100 Subject: [Haiku-commits] r23535 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801151612.m0FGCdmZ014489@sheep.berlios.de> Author: mmu_man Date: 2008-01-15 17:12:39 +0100 (Tue, 15 Jan 2008) New Revision: 23535 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23535&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: Use asm macros to call TOS. Missing ones, but existing ones compile. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-15 15:18:02 UTC (rev 23534) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-15 16:12:39 UTC (rev 23535) @@ -15,8 +15,102 @@ #ifndef __ASSEMBLER__ #include + +/* TOS calls use 16 bit param alignment, so we must generate the calls ourselves. + * We then use asm macros, one for each possible arg type and count. + * cf. how mint does it in sys/mint/arch/asm_misc.h + */ +//#if __GNUC__ >= 3 +#define TOS_CLOBBER_LIST "d1", "d2", "a0", "a1", "a2" +//#else +//#error fixme +//#endif + +/* void (no) arg */ +#define toscallV(trapnr, callnr) \ +({ \ + register int32 retvalue __asm__("d0"); \ + \ + __asm__ volatile \ + ("/* toscall(" #trapnr ", " #callnr ") */\n \ + move.w %[calln],-(%%sp)\n \ + trap %[trapn]\n \ + add.l #2,%%sp\n" \ + : "=r"(retvalue) /* output */ \ + : [trapn]"i"(trapnr),[calln]"i"(callnr) \ + /* input */ \ + : TOS_CLOBBER_LIST /* clobbered regs */ \ + ); \ + retvalue; \ +}) + +#define toscallW(trapnr, callnr, p1) \ +({ \ + register int32 retvalue __asm__("d0"); \ + int16 _p1 = (int16)(p1); \ + \ + __asm__ volatile \ + ("/* toscall(" #trapnr ", " #callnr ") */\n \ + move.w %1,-(%%sp) \n \ + move.w %[calln],-(%%sp)\n \ + trap %[trapn]\n \ + add.l #4,%%sp \n " \ + : "=r"(retvalue) /* output */ \ + : [trapn]"i"(trapnr),[calln]"i"(callnr), \ + "r"(_p1) /* input */ \ + : TOS_CLOBBER_LIST /* clobbered regs */ \ + ); \ + retvalue; \ +}) + +#define toscallL(trapnr, callnr, p1) \ +({ \ + register int32 retvalue __asm__("d0"); \ + int32 _p1 = (int32)(p1); \ + \ + __asm__ volatile \ + (/*"; toscall(" #trapnr ", " #callnr ")"*/"\n \ + move.l %1,-(%%sp) \n \ + move.w %[calln],-(%%sp)\n \ + trap %[trapn]\n \ + add.l #6,%%sp \n " \ + : "=r"(retvalue) /* output */ \ + : [trapn]"i"(trapnr),[calln]"i"(callnr), \ + "r"(_p1) /* input */ \ + : TOS_CLOBBER_LIST /* clobbered regs */ \ + ); \ + retvalue; \ +}) +#define toscallWW(trapnr, callnr, p1, p2) \ +({ \ + register int32 retvalue __asm__("d0"); \ + int16 _p1 = (int16)(p1); \ + int16 _p2 = (int16)(p2); \ + \ + __asm__ volatile \ + (/*"; toscall(" #trapnr ", " #callnr ")"*/"\n \ + move.w %2,-(%%sp) \n \ + move.w %1,-(%%sp) \n \ + move.w %[calln],-(%%sp)\n \ + trap %[trapn]\n \ + add.l #6,%%sp \n " \ + : "=r"(retvalue) /* output */ \ + : [trapn]"i"(trapnr),[calln]"i"(callnr), \ + "r"(_p1), "r"(_p2) /* input */ \ + : TOS_CLOBBER_LIST /* clobbered regs */ \ + ); \ + retvalue; \ +}) + + +/* pointer versions */ +#define toscallP(trapnr, callnr, a) toscallL(trapnr, callnr, (int32)a) + #endif /* __ASSEMBLER__ */ +#define BIOS_TRAP 13 +#define XBIOS_TRAP 14 +#define GEMDOS_TRAP 1 /* * Atari BIOS calls @@ -48,7 +142,7 @@ #ifndef __ASSEMBLER__ -extern int32 bios(uint16 nr, ...); +//extern int32 bios(uint16 nr, ...); // cf. http://www.fortunecity.com/skyscraper/apple/308/html/bios.htm @@ -65,18 +159,18 @@ }; -//#define Getmpb() bios(0) -#define Bconstat(dev) bios(1, (uint16)dev) -#define Bconin(dev) bios(2, (uint16)dev) -#define Bconout(dev, chr) bios(3, (uint16)dev, (uint16)chr) -#define Rwabs(mode, buf, count, recno, dev, lrecno) bios(4, (int16)mode, (void *)buf, (int16)count, (int16)recno, (uint16)dev, (int32)lrecno) -//#define Setexc() bios(5, ) -#define Tickcal() bios(6) -#define Getbpb(dev) (struct tosbpb *)bios(7, (uint16)dev) -#define Bcostat(dev) bios(8, (uint16)dev) -#define Mediach(dev) bios(9, (int16)dev) -#define Drvmap() (uint32)bios(10) -#define Kbshift(mode) bios(11, (uint16)mode) +//#define Getmpb() toscallV(BIOS_TRAP, 0) +#define Bconstat(dev) toscallW(BIOS_TRAP, 1, (uint16)dev) +#define Bconin(dev) toscallW(BIOS_TRAP, 2, (uint16)dev) +#define Bconout(dev, chr) toscallWW(BIOS_TRAP, 3, (uint16)dev, (uint16)chr) +#define Rwabs(mode, buf, count, recno, dev, lrecno) toscallWPWWWL(BIOS_TRAP, 4, (int16)mode, (void *)buf, (int16)count, (int16)recno, (uint16)dev, (int32)lrecno) +//#define Setexc() toscallV(BIOS_TRAP, 5, ) +#define Tickcal() toscallV(BIOS_TRAP, 6) +#define Getbpb(dev) (struct tosbpb *)toscallW(BIOS_TRAP, 7, (uint16)dev) +#define Bcostat(dev) toscallW(BIOS_TRAP, 8, (uint16)dev) +#define Mediach(dev) toscallW(BIOS_TRAP, 9, (int16)dev) +#define Drvmap() (uint32)toscallV(BIOS_TRAP, 10) +#define Kbshift(mode) toscallW(BIOS_TRAP, 11, (uint16)mode) /* handy shortcut */ static inline int Bconputs(int16 handle, const char *string) @@ -116,31 +210,31 @@ #ifndef __ASSEMBLER__ -extern int32 xbios(uint16 nr, ...); +//extern int32 xbios(uint16 nr, ...); -#define Initmous(mode, param, vec) xbios(0, (int16)mode, (void *)param, (void *)vec) -#define Physbase() (void *)xbios(2) -#define Logbase() (void *)xbios(3) -//#define Getrez() xbios(4) -#define Setscreen(log, phys, mode) xbios(5, (void *)log, (void *)phys, (int16)mode) -#define VsetScreen(log, phys, mode, modecode) xbios(5, (void *)log, (void *)phys, (int16)mode) -//#define Mfpint() xbios(13, ) -#define Rsconf(speed, flow, ucr, rsr, tsr, scr) xbios(15, (int16)speed, (int16)flow, (int16)ucr, (int16)rsr, (int16)tsr, (int16)scr) -//#define Keytbl(unshift, shift, caps) (KEYTAB *)xbios(16, (char *)unshift, (char *)shift, (char *)caps) -#define Random() xbios(17) -#define Gettime() (uint32)xbios(23) -#define Jdisint(intno) xbios(26, (int16)intno) -#define Jenabint(intno) xbios(27, (int16)intno) -#define Supexec(func) xbios(38, (void *)func) -//#define Puntaes() xbios(39) -#define DMAread(sect, count, buf, dev) xbios(42, (int32)sect, (int16)count, (void *)buf, (int16)dev) -#define DMAwrite(sect, count, buf, dev) xbios(43, (int32)sect, (int16)count, (void *)buf, (int16)dev) -#define NVMaccess(op, start, count, buffer) xbios(46, (int16)op, (int16)start, (int16)count, (char *)buffer) -#define VsetMode(mode) xbios(88, (int16)mode) -#define VgetMonitor() xbios(89) -#define Locksnd() xbios(128) -#define Unlocksnd() xbios(129) +#define Initmous(mode, param, vec) toscallWPP(XBIOS_TRAP, 0, (int16)mode, (void *)param, (void *)vec) +#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) toscallPPW(XBIOS_TRAP, 5, (void *)log, (void *)phys, (int16)mode) +#define VsetScreen(log, phys, mode, modecode) toscallPPW(XBIOS_TRAP, 5, (void *)log, (void *)phys, (int16)mode) +//#define Mfpint() toscallV(XBIOS_TRAP, 13, ) +#define Rsconf(speed, flow, ucr, rsr, tsr, scr) toscallWWWWWW(XBIOS_TRAP, 15, (int16)speed, (int16)flow, (int16)ucr, (int16)rsr, (int16)tsr, (int16)scr) +//#define Keytbl(unshift, shift, caps) (KEYTAB *)toscallPPP(XBIOS_TRAP, 16, (char *)unshift, (char *)shift, (char *)caps) +#define Random() toscallV(XBIOS_TRAP, 17) +#define Gettime() (uint32)toscallV(XBIOS_TRAP, 23) +#define Jdisint(intno) toscallW(XBIOS_TRAP, 26, (int16)intno) +#define Jenabint(intno) toscallW(XBIOS_TRAP, 27, (int16)intno) +#define Supexec(func) toscallP(XBIOS_TRAP, 38, (void *)func) +//#define Puntaes() toscallV(XBIOS_TRAP, 39) +#define DMAread(sect, count, buf, dev) toscallLWPW(XBIOS_TRAP, 42, (int32)sect, (int16)count, (void *)buf, (int16)dev) +#define DMAwrite(sect, count, buf, dev) toscallWPLW(XBIOS_TRAP, 43, (int32)sect, (int16)count, (void *)buf, (int16)dev) +#define NVMaccess(op, start, count, buffer) toscallWWWP(XBIOS_TRAP, 46, (int16)op, (int16)start, (int16)count, (char *)buffer) +#define VsetMode(mode) toscallW(XBIOS_TRAP, 88, (int16)mode) +#define VgetMonitor() toscallV(XBIOS_TRAP, 89) +#define Locksnd() toscallV(XBIOS_TRAP, 128) +#define Unlocksnd() toscallV(XBIOS_TRAP, 129) #endif /* __ASSEMBLER__ */ @@ -157,16 +251,16 @@ #define SUP_INQUIRE 1 #else -extern int32 gemdos(uint16 nr, ...); +//extern int32 gemdos(uint16 nr, ...); #define SUP_SET (void *)0 #define SUP_INQUIRE (void *)1 // official names -#define Pterm0() gemdos(0) -#define Cconin() gemdos(1) -#define Super(s) gemdos(0x20, (uint32)s) -#define Pterm(retcode) gemdos(76, (int16)retcode) +#define Pterm0() toscallV(GEMDOS_TRAP, 0) +#define Cconin() toscallV(GEMDOS_TRAP, 1) +#define Super(s) toscallP(GEMDOS_TRAP, 0x20, s) +#define Pterm(retcode) toscallW(GEMDOS_TRAP, 76, (int16)retcode) #endif /* __ASSEMBLER__ */ From mmu_man at mail.berlios.de Tue Jan 15 17:18:27 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 15 Jan 2008 17:18:27 +0100 Subject: [Haiku-commits] r23536 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801151618.m0FGIRxS014816@sheep.berlios.de> Author: mmu_man Date: 2008-01-15 17:18:27 +0100 (Tue, 15 Jan 2008) New Revision: 23536 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23536&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: Added needed toscallWLWWWL(). Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-15 16:12:39 UTC (rev 23535) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-15 16:18:27 UTC (rev 23536) @@ -81,6 +81,7 @@ ); \ retvalue; \ }) + #define toscallWW(trapnr, callnr, p1, p2) \ ({ \ register int32 retvalue __asm__("d0"); \ @@ -102,10 +103,45 @@ retvalue; \ }) +#define toscallWLWWWL(trapnr, callnr, p1, p2, p3, p4, p5, p6) \ +({ \ + register int32 retvalue __asm__("d0"); \ + int16 _p1 = (int16)(p1); \ + int32 _p2 = (int32)(p2); \ + int16 _p3 = (int16)(p3); \ + int16 _p4 = (int16)(p4); \ + int16 _p5 = (int16)(p5); \ + int32 _p6 = (int32)(p6); \ + \ + __asm__ volatile \ + (/*"; toscall(" #trapnr ", " #callnr ")"*/"\n \ + move.l %6,-(%%sp) \n \ + move.w %5,-(%%sp) \n \ + move.w %4,-(%%sp) \n \ + move.w %3,-(%%sp) \n \ + move.l %2,-(%%sp) \n \ + move.w %1,-(%%sp) \n \ + move.w %[calln],-(%%sp)\n \ + trap %[trapn]\n \ + add.l #6,%%sp \n " \ + : "=r"(retvalue) /* output */ \ + : [trapn]"i"(trapnr),[calln]"i"(callnr), \ + "r"(_p1), "r"(_p2), \ + "r"(_p3), "r"(_p4), \ + "r"(_p5), "r"(_p6) /* input */ \ + : TOS_CLOBBER_LIST /* clobbered regs */ \ + ); \ + retvalue; \ +}) /* pointer versions */ #define toscallP(trapnr, callnr, a) toscallL(trapnr, callnr, (int32)a) +#define toscallWPWWWL(trapnr, callnr, p1, p2, p3, p4, p5, p6) \ + toscallWLWWWL(trapnr, callnr, p1, (int32)p2, p3, p4, p5, p6) + + + #endif /* __ASSEMBLER__ */ #define BIOS_TRAP 13 From mmu_man at mail.berlios.de Tue Jan 15 17:31:05 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 15 Jan 2008 17:31:05 +0100 Subject: [Haiku-commits] r23537 - haiku/trunk/src/system/boot/platform/atari_m68k Message-ID: <200801151631.m0FGV5Z6015862@sheep.berlios.de> Author: mmu_man Date: 2008-01-15 17:31:04 +0100 (Tue, 15 Jan 2008) New Revision: 23537 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23537&view=rev Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h Log: Move trapn and calln as last args, as though they are named they are counted with other args numbers. Modified: haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h =================================================================== --- haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-15 16:18:27 UTC (rev 23536) +++ haiku/trunk/src/system/boot/platform/atari_m68k/toscalls.h 2008-01-15 16:31:04 UTC (rev 23537) @@ -56,8 +56,8 @@ trap %[trapn]\n \ add.l #4,%%sp \n " \ : "=r"(retvalue) /* output */ \ - : [trapn]"i"(trapnr),[calln]"i"(callnr), \ - "r"(_p1) /* input */ \ + : "r"(_p1), /* input */ \ + [trapn]"i"(trapnr),[calln]"i"(callnr) \ : TOS_CLOBBER_LIST /* clobbered regs */ \ ); \ retvalue; \ @@ -75,8 +75,8 @@ trap %[trapn]\n \ add.l #6,%%sp \n " \ : "=r"(retvalue) /* output */ \ - : [trapn]"i"(trapnr),[calln]"i"(callnr), \ - "r"(_p1) /* input */ \ + : "r"(_p1), /* input */ \ + [trapn]"i"(trapnr),[calln]"i"(callnr) \ : TOS_CLOBBER_LIST /* clobbered regs */ \ ); \ retvalue; \ @@ -96,8 +96,8 @@ trap %[trapn]\n \ add.l #6,%%sp \n " \ : "=r"(retvalue) /* output */ \ - : [trapn]"i"(trapnr),[calln]"i"(callnr), \ - "r"(_p1), "r"(_p2) /* input */ \ + : "r"(_p1), "r"(_p2), /* input */ \ + [trapn]"i"(trapnr),[calln]"i"(callnr) \ : TOS_CLOBBER_LIST /* clobbered regs */ \ ); \ retvalue; \ @@ -123,12 +123,12 @@ move.w %1,-(%%sp) \n \ move.w %[calln],-(%%sp)\n \ trap %[trapn]\n \ - add.l #6,%%sp \n " \ + add.l #18,%%sp \n " \ : "=r"(retvalue) /* output */ \ - : [trapn]"i"(trapnr),[calln]"i"(callnr), \ - "r"(_p1), "r"(_p2), \ + : "r"(_p1), "r"(_p2), \ "r"(_p3), "r"(_p4), \ - "r"(_p5), "r"(_p6) /* input */ \ + "r"(_p5), "r"(_p6), /* input */ \ + [trapn]"i"(trapnr),[calln]"i"(callnr) \ : TOS_CLOBBER_LIST /* clobbered regs */ \ ); \ retvalue; \ From axeld at mail.berlios.de Tue Jan 15 17:47:27 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 15 Jan 2008 17:47:27 +0100 Subject: [Haiku-commits] r23538 - in haiku/trunk/src/system/kernel: . vm Message-ID: <200801151647.m0FGlREY016822@sheep.berlios.de> Author: axeld Date: 2008-01-15 17:47:26 +0100 (Tue, 15 Jan 2008) New Revision: 23538 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23538&view=rev Modified: haiku/trunk/src/system/kernel/sem.c haiku/trunk/src/system/kernel/vm/vm.cpp haiku/trunk/src/system/kernel/vm/vm_low_memory.cpp Log: Made Haiku behave better when you have more memory: * with 1 GB or more, the semaphore limit is now 131072 instead of 65536. * double the heap when there is 1 GB or more (64 MB). * the low memory handler now also watches semaphore usage; in the end, we need a low resource handler, not a low memory handler. * create_sem_etc() no longer calls vfs_free_unused_vnodes() directly as this could actually deadlock (at least because the address space is a R/W lock, not a recursive lock). Modified: haiku/trunk/src/system/kernel/sem.c =================================================================== --- haiku/trunk/src/system/kernel/sem.c 2008-01-15 16:31:04 UTC (rev 23537) +++ haiku/trunk/src/system/kernel/sem.c 2008-01-15 16:47:26 UTC (rev 23538) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2002-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. * * Copyright 2001, Travis Geiselbrecht. All rights reserved. @@ -67,7 +67,7 @@ } u; }; -static const int32 kMaxSemaphores = 65536; +static const int32 kMaxSemaphores = 131072; static int32 sMaxSems = 4096; // Final value is computed based on the amount of available memory static int32 sUsedSems = 0; @@ -350,7 +350,8 @@ // compute maximal number of semaphores depending on the available memory // 128 MB -> 16384 semaphores, 448 kB fixed array size // 256 MB -> 32768, 896 kB - // 512 MB and more -> 1.75 MB + // 512 MB -> 65536, 1.75 MB + // 1024 MB and more -> 131072, 3.5 MB i = vm_page_num_pages() / 2; while (sMaxSems < i && sMaxSems < kMaxSemaphores) sMaxSems <<= 1; @@ -399,6 +400,9 @@ if (sSemsActive == false) return B_NO_MORE_SEMS; +#if 0 + // TODO: the code below might cause unwanted deadlocks, + // we need an asynchronously running low resource handler. if (sUsedSems == sMaxSems) { // The vnode cache may have collected lots of semaphores. // Freeing some unused vnodes should improve our situation. @@ -410,6 +414,7 @@ // try again with more enthusiasm vfs_free_unused_vnodes(B_LOW_MEMORY_CRITICAL); } +#endif if (sUsedSems == sMaxSems) return B_NO_MORE_SEMS; Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2008-01-15 16:31:04 UTC (rev 23537) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2008-01-15 16:47:26 UTC (rev 23538) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2002-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -3468,6 +3468,8 @@ heapSize /= 4; else if (sAvailableMemory < 200 * 1024 * 1024) heapSize /= 2; + else if (sAvailableMemory >= 1024 * 1024 * 1024) + heapSize *= 2; // map in the new heap and initialize it addr_t heapBase = vm_allocate_early(args, heapSize, heapSize, Modified: haiku/trunk/src/system/kernel/vm/vm_low_memory.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_low_memory.cpp 2008-01-15 16:31:04 UTC (rev 23537) +++ haiku/trunk/src/system/kernel/vm/vm_low_memory.cpp 2008-01-15 16:47:26 UTC (rev 23538) @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2005-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -74,13 +75,22 @@ sLastMeasurement = system_time(); uint32 freePages = vm_page_num_free_pages(); + + if (freePages > kNoteLimit) { + // TODO: work-around for a missing general low resource handler + if (sem_used_sems() * 6 > sem_max_sems() * 5) + return B_LOW_MEMORY_WARNING; + if (sem_used_sems() * 3 > sem_max_sems() * 2) + return B_LOW_MEMORY_NOTE; + } + if (freePages >= kNoteLimit) return B_NO_LOW_MEMORY; // specify low memory level if (freePages < kCriticalLimit) return B_LOW_MEMORY_CRITICAL; - else if (freePages < kWarnLimit) + if (freePages < kWarnLimit) return B_LOW_MEMORY_WARNING; return B_LOW_MEMORY_NOTE; From stippi at mail.berlios.de Tue Jan 15 19:01:29 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 15 Jan 2008 19:01:29 +0100 Subject: [Haiku-commits] r23539 - haiku/trunk/src/kits/storage/disk_device Message-ID: <200801151801.m0FI1T1e000710@sheep.berlios.de> Author: stippi Date: 2008-01-15 19:01:27 +0100 (Tue, 15 Jan 2008) New Revision: 23539 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23539&view=rev Modified: haiku/trunk/src/kits/storage/disk_device/Partition.cpp Log: * fix typo in the documentation for GetVolume() Modified: haiku/trunk/src/kits/storage/disk_device/Partition.cpp =================================================================== --- haiku/trunk/src/kits/storage/disk_device/Partition.cpp 2008-01-15 16:47:26 UTC (rev 23538) +++ haiku/trunk/src/kits/storage/disk_device/Partition.cpp 2008-01-15 18:01:27 UTC (rev 23539) @@ -351,7 +351,7 @@ // GetVolume /*! \brief Returns a BVolume for the partition. - The can succeed only, if the partition is mounted. + This can only succeed, if the partition is mounted. \param volume Pointer to a pre-allocated BVolume, to be initialized to represent the volume. From axeld at mail.berlios.de Tue Jan 15 19:03:34 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 15 Jan 2008 19:03:34 +0100 Subject: [Haiku-commits] r23540 - haiku/trunk/src/system/kernel/cache Message-ID: <200801151803.m0FI3Ybh001440@sheep.berlios.de> Author: axeld Date: 2008-01-15 19:03:33 +0100 (Tue, 15 Jan 2008) New Revision: 23540 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23540&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp haiku/trunk/src/system/kernel/cache/block_cache_private.h Log: * Improved block allocation. * Made the block_cache KDL command dump a bit more useful info (number of referenced and dirty blocks). * Minor cleanup. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-01-15 18:01:27 UTC (rev 23539) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-01-15 18:03:33 UTC (rev 23540) @@ -463,25 +463,52 @@ } +cached_block * +block_cache::_GetUnusedBlock() +{ + TRACE(("block_cache: get unused block\n")); + + for (block_list::Iterator iterator = unused_blocks.GetIterator(); + cached_block *block = iterator.Next();) { + // this can only happen if no transactions are used + if (block->is_dirty) + write_cached_block(this, block, false); + + // remove block from lists + iterator.Remove(); + hash_remove(hash, block); + return block; + } + + return NULL; +} + + /*! Allocates a new block for \a blockNumber, ready for use */ cached_block * block_cache::NewBlock(off_t blockNumber) { cached_block *block = new(nothrow) cached_block; + if (block != NULL) { + block_range *range = GetFreeRange(); + if (range == NULL) { + delete block; + block = NULL; + } else + range->Allocate(this, block); + } if (block == NULL) { - FATAL(("could not allocate block!\n")); - return NULL; - } + dprintf("block allocation failed, unused list is %sempty.\n", + unused_blocks.IsEmpty() ? "" : "not "); - block_range *range = GetFreeRange(); - if (range == NULL) { - FATAL(("could not get range!\n")); - delete block; - return NULL; + // allocation failed, try to reuse an unused block + block = _GetUnusedBlock(); + if (block == NULL) { + FATAL(("could not allocate block!\n")); + return NULL; + } } - range->Allocate(this, block); - block->block_number = blockNumber; block->ref_count = 0; block->accessed = 0; @@ -504,9 +531,8 @@ { TRACE(("block_cache: remove up to %ld unused blocks\n", count)); - for (block_list::Iterator it = unused_blocks.GetIterator(); - cached_block *block = it.Next();) { - + for (block_list::Iterator iterator = unused_blocks.GetIterator(); + cached_block *block = iterator.Next();) { if (maxAccessed < block->accessed) continue; @@ -518,7 +544,7 @@ write_cached_block(this, block, false); // remove block from lists - it.Remove(); + iterator.Remove(); hash_remove(hash, block); FreeBlock(block); @@ -946,27 +972,37 @@ if (showBlocks) { kprintf(" blocks:\n"); - kprintf("address block no. current original parent refs access flags transact prev. trans\n"); + kprintf("address block no. current original parent refs access " + "flags transact prev. trans\n"); } + uint32 referenced = 0; uint32 count = 0; + uint32 dirty = 0; hash_iterator iterator; hash_open(cache->hash, &iterator); cached_block *block; while ((block = (cached_block *)hash_next(cache->hash, &iterator)) != NULL) { if (showBlocks) { - kprintf("%08lx %9Ld %08lx %08lx %08lx %5ld %6ld %c%c%c%c%c %08lx %08lx\n", - (addr_t)block, block->block_number, (addr_t)block->current_data, - (addr_t)block->original_data, (addr_t)block->parent_data, - block->ref_count, block->accessed, block->busy ? 'B' : '-', - block->is_writing ? 'W' : '-', block->is_dirty ? 'B' : '-', - block->unused ? 'U' : '-', block->unmapped ? 'M' : '-', - (addr_t)block->transaction, (addr_t)block->previous_transaction); + kprintf("%08lx %9Ld %08lx %08lx %08lx %5ld %6ld %c%c%c%c%c %08lx " + "%08lx\n", (addr_t)block, block->block_number, + (addr_t)block->current_data, (addr_t)block->original_data, + (addr_t)block->parent_data, block->ref_count, block->accessed, + block->busy ? 'B' : '-', block->is_writing ? 'W' : '-', + block->is_dirty ? 'B' : '-', block->unused ? 'U' : '-', + block->unmapped ? 'M' : '-', (addr_t)block->transaction, + (addr_t)block->previous_transaction); } + + if (block->is_dirty) + dirty++; + if (block->ref_count) + referenced++; count++; } - kprintf(" %ld blocks.\n", count); + kprintf(" %ld blocks total, %ld dirty, %ld referenced.\n", count, dirty, + referenced); hash_close(cache->hash, &iterator, false); return 0; Modified: haiku/trunk/src/system/kernel/cache/block_cache_private.h =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache_private.h 2008-01-15 18:01:27 UTC (rev 23539) +++ haiku/trunk/src/system/kernel/cache/block_cache_private.h 2008-01-15 18:03:33 UTC (rev 23540) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef BLOCK_CACHE_PRIVATE_H @@ -125,13 +125,17 @@ block_range *GetFreeRange(); block_range *GetRange(void *address); - void RemoveUnusedBlocks(int32 maxAccessed = LONG_MAX, int32 count = LONG_MAX); + void RemoveUnusedBlocks(int32 maxAccessed = LONG_MAX, + int32 count = LONG_MAX); void FreeBlock(cached_block *block); cached_block *NewBlock(off_t blockNumber); void Free(void *address); void *Allocate(); static void LowMemoryHandler(void *data, int32 level); + +private: + cached_block *_GetUnusedBlock(); }; From bonefish at mail.berlios.de Tue Jan 15 21:04:41 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 15 Jan 2008 21:04:41 +0100 Subject: [Haiku-commits] r23541 - haiku/trunk/build/scripts Message-ID: <200801152004.m0FK4fF6020010@sheep.berlios.de> Author: bonefish Date: 2008-01-15 21:04:40 +0100 (Tue, 15 Jan 2008) New Revision: 23541 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23541&view=rev Modified: haiku/trunk/build/scripts/build_haiku_image Log: When installing Haiku into a directory, unzipping optional packages overwrites existing files without prompt, now. Modified: haiku/trunk/build/scripts/build_haiku_image =================================================================== --- haiku/trunk/build/scripts/build_haiku_image 2008-01-15 18:03:33 UTC (rev 23540) +++ haiku/trunk/build/scripts/build_haiku_image 2008-01-15 20:04:40 UTC (rev 23541) @@ -85,7 +85,7 @@ attrrmrf $unzipDir else - $unzip -q -d ${tPrefix}$targetUnzipDir ${sPrefix}$zipFile + $unzip -q -o -d ${tPrefix}$targetUnzipDir ${sPrefix}$zipFile fi } From jackburton at mail.berlios.de Tue Jan 15 22:06:54 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 15 Jan 2008 22:06:54 +0100 Subject: [Haiku-commits] r23542 - haiku/trunk/src/tests/kits/app/messaging Message-ID: <200801152106.m0FL6sbR025338@sheep.berlios.de> Author: jackburton Date: 2008-01-15 22:06:54 +0100 (Tue, 15 Jan 2008) New Revision: 23542 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23542&view=rev Modified: haiku/trunk/src/tests/kits/app/messaging/Jamfile haiku/trunk/src/tests/kits/app/messaging/PortLinkTest.cpp Log: Fixed PortLinkTest build, and also corrected a check. Looks like attaching 100000 bytes fails. Any idea ? Modified: haiku/trunk/src/tests/kits/app/messaging/Jamfile =================================================================== --- haiku/trunk/src/tests/kits/app/messaging/Jamfile 2008-01-15 20:04:40 UTC (rev 23541) +++ haiku/trunk/src/tests/kits/app/messaging/Jamfile 2008-01-15 21:06:54 UTC (rev 23542) @@ -2,6 +2,7 @@ UsePrivateHeaders app ; UsePrivateHeaders interface ; +SubDirHdrs [ FDirName $(HAIKU_TOP) src kits app ] ; SimpleTest PortLinkTest : PortLinkTest.cpp Modified: haiku/trunk/src/tests/kits/app/messaging/PortLinkTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/app/messaging/PortLinkTest.cpp 2008-01-15 20:04:40 UTC (rev 23541) +++ haiku/trunk/src/tests/kits/app/messaging/PortLinkTest.cpp 2008-01-15 21:06:54 UTC (rev 23542) @@ -41,8 +41,8 @@ sender.StartMessage('tst3', 100000); sender.Attach(&port, 100000); - if (sender.EndMessage() == B_OK) { - fprintf(stderr, "attaching huge message succeeded!\n"); + if (sender.EndMessage() != B_OK) { + fprintf(stderr, "attaching huge message (100000 bytes) failed!\n"); return -1; } From jackburton at mail.berlios.de Tue Jan 15 22:14:14 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 15 Jan 2008 22:14:14 +0100 Subject: [Haiku-commits] r23543 - haiku/trunk/src/tests/kits/app/messaging Message-ID: <200801152114.m0FLEESw026037@sheep.berlios.de> Author: jackburton Date: 2008-01-15 22:14:13 +0100 (Tue, 15 Jan 2008) New Revision: 23543 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23543&view=rev Modified: haiku/trunk/src/tests/kits/app/messaging/PortLinkTest.cpp Log: The check was right, I just got it wrong. Sending a big message is supposed to fail. Sorry. Modified: haiku/trunk/src/tests/kits/app/messaging/PortLinkTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/app/messaging/PortLinkTest.cpp 2008-01-15 21:06:54 UTC (rev 23542) +++ haiku/trunk/src/tests/kits/app/messaging/PortLinkTest.cpp 2008-01-15 21:14:13 UTC (rev 23543) @@ -41,8 +41,8 @@ sender.StartMessage('tst3', 100000); sender.Attach(&port, 100000); - if (sender.EndMessage() != B_OK) { - fprintf(stderr, "attaching huge message (100000 bytes) failed!\n"); + if (sender.EndMessage() == B_OK) { + fprintf(stderr, "attaching huge message succeded (it shouldn't)!\n"); return -1; } From bonefish at mail.berlios.de Tue Jan 15 22:21:04 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 15 Jan 2008 22:21:04 +0100 Subject: [Haiku-commits] r23544 - haiku/trunk/build/scripts Message-ID: <200801152121.m0FLL4le026636@sheep.berlios.de> Author: bonefish Date: 2008-01-15 22:21:02 +0100 (Tue, 15 Jan 2008) New Revision: 23544 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23544&view=rev Modified: haiku/trunk/build/scripts/build_haiku_image Log: Copying source directories to the image was broken, when building from the root of the source tree. Added a work-around that should fix the problem. Modified: haiku/trunk/build/scripts/build_haiku_image =================================================================== --- haiku/trunk/build/scripts/build_haiku_image 2008-01-15 21:14:13 UTC (rev 23543) +++ haiku/trunk/build/scripts/build_haiku_image 2008-01-15 21:21:02 UTC (rev 23544) @@ -184,19 +184,29 @@ $mkdir -p ${sourcesDest} fi +# When building in the root of the source directory, sourceDir is "." and +# the source directory are not prefixed, which breaks the sed expressions +# used below. We work around, by adjusting the strings to match and insert. +sourcePathPrefix=$sourceDir +destPathPrefix=$sourcesDest +if [ $sourcePathPrefix = "." ]; then + sourcePathPrefix="" + destPathPrefix="${sourcesDest}/" +fi + for sourcesDir in ${sourceDirsToCopy}; do echo " sources dir: ${sourcesDir}" # create all subdirectories subDirs=$(find ${sourcesDir} -type d | grep -v '.svn' | - sed -e "s@^${sourceDir}@${sourcesDest}@") + sed -e "s@^${sourcePathPrefix}@${destPathPrefix}@") $mkdir -p ${subDirs} - + # get all files and copy each one individually sourceFiles=$(find $sourcesDir -type f | grep -v '.svn') for sourceFile in $sourceFiles; do destSourceFile=$(echo $sourceFile | - sed -e "s@^${sourceDir}@${sourcesDest}@") + sed -e "s@^${sourcePathPrefix}@${destPathPrefix}@") $cp ${sPrefix}$sourceFile $destSourceFile done done From stippi at mail.berlios.de Wed Jan 16 00:09:20 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 16 Jan 2008 00:09:20 +0100 Subject: [Haiku-commits] r23545 - haiku/trunk/src/preferences/drivesetup Message-ID: <200801152309.m0FN9KuT001825@sheep.berlios.de> Author: stippi Date: 2008-01-16 00:09:20 +0100 (Wed, 16 Jan 2008) New Revision: 23545 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23545&view=rev Added: haiku/trunk/src/preferences/drivesetup/InitParamsPanel.cpp haiku/trunk/src/preferences/drivesetup/InitParamsPanel.h Modified: haiku/trunk/src/preferences/drivesetup/DiskView.cpp haiku/trunk/src/preferences/drivesetup/DiskView.h haiku/trunk/src/preferences/drivesetup/MainWindow.cpp haiku/trunk/src/preferences/drivesetup/MainWindow.h haiku/trunk/src/preferences/drivesetup/PartitionList.cpp Log: * disable sorting in the partitions list * sort the partitions by id (TODO: should be disk offset, but works as intended now) * expand the partition tree entries by default * renamed DriveVisitor to ListPopulatorVisitor, moved implementation into class definition * added MountAllVisitor and used it to implement according menu item * added menu item members to MainWindow, so it keeps the pointers * added MainWindow::_EnabledDisableMenuItems() which looks for the current disk and partition and their properties to en-/disable the items * moved BDiskDevice member from DiskView to MainWindow, renamed to fCurrentDisk * implemented mounting and unmounting the currently selected partition, mounting works, unmounting does not work as in Tracker, but the error description is not as helpful, or just as helpful, since Force Unmount does not work in Tracker at the moment * implemented initializing the selected partition, not tested to the end, but likely works, so beware! (TODO: finish the parameter window and use it, partitions are hardcoded to "BFS Init Test" and 2048 blocksize). The process displays a warning at the beginning and another one at the end before writing anything to disk, but please do take it seriously... :-) * store and restore the listview column settings (width of columns mostly) * more appropriate usage of the BDiskDeviceRoster API * improved DiskView display a little with frames and more contrast in the colors * implemented FrameResized() to adapt the box layout * no longer pass disk pointer to BDiskDeviceRoster::VisitEachPartition(), since it will overwrite it! * no longer use BDiskDeviceRoster at all, BPartition::VisitEachDescendant() is what we need * added a WIP InitParamsPanel, does not compile, but is not added to the Jamfile yet, it will be a blocking panel like a BAlert and will later be refactored into the parameter editor add-on for BFS Modified: haiku/trunk/src/preferences/drivesetup/DiskView.cpp =================================================================== --- haiku/trunk/src/preferences/drivesetup/DiskView.cpp 2008-01-15 21:21:02 UTC (rev 23544) +++ haiku/trunk/src/preferences/drivesetup/DiskView.cpp 2008-01-15 23:09:20 UTC (rev 23545) @@ -7,7 +7,6 @@ */ #include "DiskView.h" -#include #include #include @@ -122,6 +121,11 @@ frame.InsetBy(1, 1); fView->StrokeRect(frame); frame.InsetBy(1, 1); + } else { + fView->SetHighColor(tint_color(box.color, B_DARKEN_2_TINT)); + frame.InsetBy(-1, -1); + fView->StrokeRect(frame); + frame.InsetBy(1, 1); } fView->SetHighColor(box.color); @@ -129,6 +133,12 @@ } } + void Unset() + { + fColorIndex = 0; + fBoxMap.Clear(); + } + private: rgb_color _NextColor() @@ -153,14 +163,15 @@ DiskView::DiskView(const BRect& frame, uint32 resizeMode) - : Inherited(frame, "diskview", resizeMode, B_WILL_DRAW) + : Inherited(frame, "diskview", resizeMode, + B_WILL_DRAW | B_FRAME_EVENTS) , fDisk(NULL) , fPartitionDrawer(new PartitionDrawer(this)) { for (int32 i = 0; i < kMaxPartitionColors; i++) { - kPartitionColors[i].red = 120 + ((i * 1675) & 120); - kPartitionColors[i].green = 120 + ((i * 318) & 120); - kPartitionColors[i].blue = 120 + ((i * 9328) & 120); + kPartitionColors[i].red = 90 + ((i * 1675) & 160); + kPartitionColors[i].green = 90 + ((i * 318) & 160); + kPartitionColors[i].blue = 90 + ((i * 9328) & 160); kPartitionColors[i].alpha = 255; } } @@ -190,14 +201,32 @@ void +DiskView::FrameResized(float width, float height) +{ + _UpdateLayout(); +} + + +void DiskView::SetDisk(BDiskDevice* disk, partition_id selectedPartition) { - delete fDisk; fDisk = disk; fPartitionDrawer->SetSelectedPartition(selectedPartition); + _UpdateLayout(); +} - BDiskDeviceRoster roster; - roster.VisitEachPartition(fPartitionDrawer, fDisk); +// #pragma mark - + + +void +DiskView::_UpdateLayout() +{ + fPartitionDrawer->Unset(); + + if (fDisk) + fDisk->VisitEachDescendant(fPartitionDrawer); + Invalidate(); } + Modified: haiku/trunk/src/preferences/drivesetup/DiskView.h =================================================================== --- haiku/trunk/src/preferences/drivesetup/DiskView.h 2008-01-15 21:21:02 UTC (rev 23544) +++ haiku/trunk/src/preferences/drivesetup/DiskView.h 2008-01-15 23:09:20 UTC (rev 23545) @@ -19,10 +19,13 @@ // BView interface virtual void Draw(BRect updateRect); + virtual void FrameResized(float width, float height); void SetDisk(BDiskDevice* disk, partition_id selectedPartition); private: + void _UpdateLayout(); + BDiskDevice* fDisk; class PartitionDrawer; Added: haiku/trunk/src/preferences/drivesetup/InitParamsPanel.cpp =================================================================== --- haiku/trunk/src/preferences/drivesetup/InitParamsPanel.cpp 2008-01-15 21:21:02 UTC (rev 23544) +++ haiku/trunk/src/preferences/drivesetup/InitParamsPanel.cpp 2008-01-15 23:09:20 UTC (rev 23545) @@ -0,0 +1,158 @@ +#include "InitParamsPanel.h" + +#include + +#include +#include +#include +#include + + + +class InitParamsPanel::EscapeFilter : public BMessageFilter { +public: + EscapeFilter(InitParamsPanel* target) + : BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE), + fPanel(target) + { + } + virtual ~EscapeFilter() + { + } + virtual filter_result Filter(BMessage* message, BHandler** target) + { + filter_result result = B_DISPATCH_MESSAGE; + switch (message->what) { + case B_KEY_DOWN: + case B_UNMAPPED_KEY_DOWN: { + uint32 key; + if (message->FindInt32("raw_char", (int32*)&key) >= B_OK) { + if (key == B_ESCAPE) { + result = B_SKIP_MESSAGE; + fPanel->Cancel(); + } + } + break; + } + default: + break; + } + return result; + } +private: + InitParamsPanel* fPanel; +}; + + +// #pragma mark - + + +enum { + MSG_OK = 'okok', + MSG_CANCEL = 'cncl' +}; + + + +InitParamsPanel::InitParamsPanel(BWindow *window) + : Panel(BRect(300.0, 200.0, 600.0, 400.0), 0, B_MODAL_WINDOW_LOOK, + B_MODAL_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS), + , fEscapeFilter(new EscapeFilter(this)) + , fExitSemaphore(create_sem(0, "InitParamsPanel exit") + , fWindow(window) + , fReturnValue(GO_CANCELED) +{ + AddCommonFilter(fEscapeFilter); + + ... + + AddChild(topView); + SetDefaultButton(okButton); + + AddToSubset(fWindow); +} + + +InitParamsPanel::~InitParamsPanel() +{ + RemoveCommonFilter(fEscapeFilter); + delete fEscapeFilter; + + delete_sem(fExitSemaphore); +} + + +bool +InitParamsPanel::QuitRequested() +{ + release_sem(fExitSemaphore); + return false; +} + + +void +InitParamsPanel::MessageReceived(BMessage* message) +{ + switch (msg->what) { + case MSG_CANCEL: + Cancel(); + break; + + case MSG_OK: + fReturnValue = GO_SUCCESS; + release_sem(fExitSemaphore); + break; + } + default: + BWindow::MessageReceived(message); + } +} + + +int32 +InitParamsPanel::Answer(BString& name, BString& parameters) +{ + // run the window thread, to get an initial layout of the controls + Hide(); + Show(); + if (!Lock()) + return false; + + // center the panel above the parent window + BRect frame = Frame(); + BRect parentFrame = fWindow->Frame(); + MoveTo((parentFrame.left + parentFrame.right - frame.Width()) / 2.0, + (parentFrame.top + parentFrame.bottom - frame.Height()) / 2.0); + + fNameTC->SetText(name.String()); + fNameTC->MakeFocus(true); + + Show(); + Unlock(); + + // block this thread now + acquire_sem(fExitSemaphore); + + if (fMode == GO_SUCCESS) { + name = fNameTC->Text(); + parameters ... + } + + Lock(); + Quit(); + return fReturnValue; +} + + +void +InitParamsPanel::Cancel() +{ + fReturnValue = GO_CANCELED; + release_sem(fExitSemaphore); +} + + + + + + Added: haiku/trunk/src/preferences/drivesetup/InitParamsPanel.h =================================================================== --- haiku/trunk/src/preferences/drivesetup/InitParamsPanel.h 2008-01-15 21:21:02 UTC (rev 23544) +++ haiku/trunk/src/preferences/drivesetup/InitParamsPanel.h 2008-01-15 23:09:20 UTC (rev 23545) @@ -0,0 +1,36 @@ +#ifndef INIT_PARAMS_PANEL_H +#define INIT_PARAMS_PANEL_H + +#include + +class BMenuField; +class BTextControl; + +enum { + GO_CANCELED = 0, + GO_SUCCESS +}; + +class InitParamsPanel : public BWindow { +public: + InitParamsPanel(BWindow* window); + virtual ~InitParamsPanel(); + + virtual bool QuitRequested(); + virtual void MessageReceived(BMessage* message); + + int32 Go(BString& name, BString& parameters); + void Cancel(); + +private: + class EscapeFilter; + EscapeFilter* fEscapeFilter; + sem_id fExitSemaphore; + BWindow* fWindow; + int32 fReturnValue; + + BTextControl* fNameTC; + BMenuField* fBlockSizeMF; +}; + +#endif // INIT_PARAMS_PANEL_H Modified: haiku/trunk/src/preferences/drivesetup/MainWindow.cpp =================================================================== --- haiku/trunk/src/preferences/drivesetup/MainWindow.cpp 2008-01-15 21:21:02 UTC (rev 23544) +++ haiku/trunk/src/preferences/drivesetup/MainWindow.cpp 2008-01-15 23:09:20 UTC (rev 23545) @@ -12,6 +12,7 @@ #include "PartitionList.h" #include "Support.h" +#include #include #include @@ -28,18 +29,59 @@ #include -class DriveVisitor : public BDiskDeviceVisitor { +class ListPopulatorVisitor : public BDiskDeviceVisitor { public: - DriveVisitor(PartitionListView* list); + ListPopulatorVisitor(PartitionListView* list) + : fPartitionList(list) + { + // start with an empty list + int32 rows = fPartitionList->CountRows(); + for (int32 i = rows - 1; i >= 0; i--) { + BRow* row = fPartitionList->RowAt(i); + fPartitionList->RemoveRow(row); + delete row; + } + } - virtual bool Visit(BDiskDevice* device); - virtual bool Visit(BPartition* partition, int32 level); + virtual bool Visit(BDiskDevice* device) + { + fPartitionList->AddPartition(device); + return false; // Don't stop yet! + } + virtual bool Visit(BPartition* partition, int32 level) + { + fPartitionList->AddPartition(partition); + return false; // Don't stop yet! + } + private: PartitionListView* fPartitionList; }; +class MountAllVisitor : public BDiskDeviceVisitor { +public: + MountAllVisitor() + { + } + + virtual bool Visit(BDiskDevice* device) + { + return false; // Don't stop yet! + } + + virtual bool Visit(BPartition* partition, int32 level) + { + partition->Mount(); + return false; // Don't stop yet! + } + +private: + PartitionListView* fPartitionList; +}; + + enum { MSG_MOUNT_ALL = 'mnta', MSG_MOUNT = 'mnts', @@ -60,45 +102,67 @@ MainWindow::MainWindow(BRect frame) : BWindow(frame, "DriveSetup", B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE) + , fCurrentDisk(NULL) { - BMenuBar* rootMenu = new BMenuBar(Bounds(), "root menu"); + BMenuBar* menuBar = new BMenuBar(Bounds(), "root menu"); + // create all the menu items + fFormatMI = new BMenuItem("Format", new BMessage(MSG_FORMAT)); + fEjectMI = new BMenuItem("Eject", new BMessage(MSG_EJECT), 'E'); + fSurfaceTestMI = new BMenuItem("Surface Test", + new BMessage(MSG_SURFACE_TEST)); + fRescanMI = new BMenuItem("Rescan", new BMessage(MSG_RESCAN)); + + fCreatePrimaryMI = new BMenuItem("Primary", + new BMessage(MSG_CREATE_PRIMARY)); + fCreateExtendedMI = new BMenuItem("Extended", + new BMessage(MSG_CREATE_EXTENDED)); + fCreateLogicalMI = new BMenuItem("Logical", + new BMessage(MSG_CREATE_LOGICAL)); + + fMountMI = new BMenuItem("Mount", new BMessage(MSG_MOUNT), 'M'); + fUnmountMI = new BMenuItem("Unmount", new BMessage(MSG_UNMOUNT), 'U'); + fMountAllMI = new BMenuItem("Mount All", + new BMessage(MSG_MOUNT_ALL), 'M', B_SHIFT_KEY); + // Disk menu - BMenu* menu = new BMenu("Disk"); - menu->AddItem(new BMenuItem("Format", new BMessage(MSG_FORMAT), 'F')); - menu->AddItem(new BMenuItem("Eject", new BMessage(MSG_EJECT), 'E')); - menu->AddItem(new BMenuItem("Surface Test", - new BMessage(MSG_SURFACE_TEST), 'T')); - menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Rescan", new BMessage(MSG_RESCAN))); - rootMenu->AddItem(menu); + fDiskMenu = new BMenu("Disk"); + fDiskMenu->AddItem(fFormatMI); + fDiskMenu->AddItem(fEjectMI); + fDiskMenu->AddItem(fSurfaceTestMI); + fDiskMenu->AddSeparatorItem(); + + fDiskMenu->AddItem(fRescanMI); + menuBar->AddItem(fDiskMenu); + // Parition menu - menu = new BMenu("Partition"); - BMenu* createMenu = new BMenu("Create"); - menu->AddItem(createMenu); + fPartitionMenu = new BMenu("Partition"); + fCreateMenu = new BMenu("Create"); + fCreateMenu->AddItem(fCreatePrimaryMI); + fCreateMenu->AddItem(fCreateExtendedMI); + fCreateMenu->AddItem(fCreateLogicalMI); + fPartitionMenu->AddItem(fCreateMenu); + fInitMenu = new BMenu("Initialize"); - menu->AddItem(fInitMenu); - menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Mount", new BMessage(MSG_MOUNT), 'M')); - menu->AddItem(new BMenuItem("Unmount", new BMessage(MSG_UNMOUNT), 'U')); - menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Mount All", - new BMessage(MSG_MOUNT_ALL), 'M', B_SHIFT_KEY)); - rootMenu->AddItem(menu); + fPartitionMenu->AddItem(fInitMenu); - AddChild(rootMenu); + fPartitionMenu->AddSeparatorItem(); - createMenu->AddItem(new BMenuItem("Primary", - new BMessage(MSG_CREATE_PRIMARY))); - createMenu->AddItem(new BMenuItem("Extended", - new BMessage(MSG_CREATE_EXTENDED))); - createMenu->AddItem(new BMenuItem("Logical", - new BMessage(MSG_CREATE_LOGICAL))); + fPartitionMenu->AddItem(fMountMI); + fPartitionMenu->AddItem(fUnmountMI); + fPartitionMenu->AddSeparatorItem(); + + fPartitionMenu->AddItem(fMountAllMI); + menuBar->AddItem(fPartitionMenu); + + AddChild(menuBar); + + // add DiskView BRect r(Bounds()); - r.top = rootMenu->Frame().bottom + 1; + r.top = menuBar->Frame().bottom + 1; r.bottom = floorf(r.top + r.Height() * 0.33); fDiskView = new DiskView(r, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); AddChild(fDiskView); @@ -114,26 +178,34 @@ fListView->SetSelectionMessage(new BMessage(MSG_PARTITION_ROW_SELECTED)); fListView->SetTarget(this); - // Populate the Initialiaze menu with the available file systems + // populate the Initialiaze menu with the available file systems _ScanFileSystems(); - // Visit all disks in the system and show their contents + // visit all disks in the system and show their contents _ScanDrives(); + + _EnabledDisableMenuItems(NULL, -1); } +MainWindow::~MainWindow() +{ + delete fCurrentDisk; +} + + void MainWindow::MessageReceived(BMessage* message) { switch (message->what) { case MSG_MOUNT_ALL: - printf("MSG_MOUNT_ALL\n"); + _MountAll(); break; case MSG_MOUNT: - printf("MSG_MOUNT\n"); + _Mount(fCurrentDisk, fCurrentPartitionID); break; case MSG_UNMOUNT: - printf("MSG_UNMOUNT\n"); + _Unmount(fCurrentDisk, fCurrentPartitionID); break; case MSG_FORMAT: @@ -150,12 +222,22 @@ printf("MSG_CREATE_LOGICAL\n"); break; - case MSG_INITIALIZE: - printf("MSG_INITIALIZE\n"); + case MSG_INITIALIZE: { + BString diskSystemName; + if (message->FindString("format", &diskSystemName) != B_OK) + break; + _Initialize(fCurrentDisk, fCurrentPartitionID, diskSystemName); break; + } case MSG_EJECT: - printf("MSG_EJECT\n"); + // TODO: completely untested, especially interesting + // if partition list behaves when partitions disappear + if (fCurrentDisk) { + // TODO: only if no partitions are mounted anymore? + fCurrentDisk->Eject(true); + _ScanDrives(); + } break; case MSG_SURFACE_TEST: printf("MSG_SURFACE_TEST\n"); @@ -193,7 +275,12 @@ { if (archive->ReplaceRect("window frame", Frame()) < B_OK) archive->AddRect("window frame", Frame()); - // TODO: store column list settings + + BMessage columnSettings; + fListView->SaveState(&columnSettings); + if (archive->ReplaceMessage("column settings", &columnSettings) < B_OK) + archive->AddMessage("column settings", &columnSettings); + return B_OK; } @@ -209,7 +296,11 @@ ResizeTo(frame.Width(), frame.Height()); } } - // TODO: restore column list settings + + BMessage columnSettings; + if (archive->FindMessage("column settings", &columnSettings) == B_OK) + fListView->LoadState(&columnSettings); + return B_OK; } @@ -220,10 +311,8 @@ void MainWindow::_ScanDrives() { - DriveVisitor driveVisitor(fListView); - BPartition* partition = NULL; - BDiskDevice device; - fDDRoster.VisitEachPartition(&driveVisitor, &device, &partition); + ListPopulatorVisitor driveVisitor(fListView); + fDDRoster.VisitEachPartition(&driveVisitor); } @@ -235,10 +324,10 @@ BDiskSystem diskSystem; fDDRoster.RewindDiskSystems(); - while(fDDRoster.GetNextDiskSystem(&diskSystem) == B_OK) { + while (fDDRoster.GetNextDiskSystem(&diskSystem) == B_OK) { if (diskSystem.IsFileSystem() && diskSystem.SupportsInitializing()) { BMessage* message = new BMessage(MSG_INITIALIZE); - message->AddString("format", diskSystem.Name()); + message->AddString("format", diskSystem.PrettyName()); BString label = diskSystem.PrettyName(); label << B_UTF8_ELLIPSIS; fInitMenu->AddItem(new BMenuItem(label.String(), message)); @@ -247,12 +336,20 @@ } +// #pragma mark - + + void MainWindow::_AdaptToSelectedPartition() { + delete fCurrentDisk; + fCurrentDisk = NULL; + fCurrentPartitionID = -1; + BRow* _selectedRow = fListView->CurrentSelection(); if (!_selectedRow) { fDiskView->SetDisk(NULL, -1); + _EnabledDisableMenuItems(NULL, -1); return; } @@ -270,47 +367,278 @@ if (!topLevelRow || !selectedRow) return; - BDiskDevice* disk = new BDiskDevice(); - disk->SetTo(topLevelRow->ID()); - fDiskView->SetDisk(disk, selectedRow->ID()); + fCurrentDisk = new BDiskDevice(); + status_t ret = fCurrentDisk->SetTo(topLevelRow->ID()); + if (ret < B_OK) { + printf("error switching disks: %s\n", strerror(ret)); + delete fCurrentDisk; + fCurrentDisk = NULL; + return; + } + fCurrentPartitionID = selectedRow->ID(); + + fDiskView->SetDisk(fCurrentDisk, fCurrentPartitionID); + _EnabledDisableMenuItems(fCurrentDisk, fCurrentPartitionID); } -// #pragma mark - DriveVisitor +void +MainWindow::_EnabledDisableMenuItems(BDiskDevice* disk, + partition_id selectedPartition) +{ + if (!disk) { + fFormatMI->SetEnabled(false); + fEjectMI->SetEnabled(false); + fSurfaceTestMI->SetEnabled(false); + fPartitionMenu->SetEnabled(false); + } else { +// fFormatMI->SetEnabled(true); + fEjectMI->SetEnabled(disk->IsRemovableMedia()); +// fSurfaceTestMI->SetEnabled(true); -DriveVisitor::DriveVisitor(PartitionListView* list) - : fPartitionList(list) + fPartitionMenu->SetEnabled(true); +fCreatePrimaryMI->SetEnabled(false); +fCreateExtendedMI->SetEnabled(false); +fCreateLogicalMI->SetEnabled(false); + + BPartition* partition = disk->FindDescendant(selectedPartition); + if (partition) { + fInitMenu->SetEnabled(!partition->IsMounted()); + fMountMI->SetEnabled(!partition->IsMounted()); + fUnmountMI->SetEnabled(partition->IsMounted()); + } else { + fInitMenu->SetEnabled(false); + fMountMI->SetEnabled(false); + fUnmountMI->SetEnabled(false); + } + fMountAllMI->SetEnabled(true); + } +} + + +void +MainWindow::_DisplayPartitionError(BString _message, + const BPartition* partition, status_t error) const { - // start with an empty list - int32 rows = fPartitionList->CountRows(); - for (int32 i = rows - 1; i >= 0; i--) { - BRow* row = fPartitionList->RowAt(i); - fPartitionList->RemoveRow(row); - delete row; + char message[1024]; + + if (partition && _message.FindFirst("%s") >= 0) { + BString name; + name << " \"" << partition->ContentName() << "\""; + sprintf(message, _message.String(), name.String()); + } else { + _message.ReplaceAll("%s", ""); + sprintf(message, _message.String()); } + + if (error < B_OK) { + BString helper = message; + sprintf(message, "%s\n\nError: %s", helper.String(), strerror(error)); + } + + BAlert* alert = new BAlert("error", message, "Ok", NULL, NULL, + B_WIDTH_FROM_WIDEST, error < B_OK ? B_STOP_ALERT : B_INFO_ALERT); + alert->Go(NULL); } -bool -DriveVisitor::Visit(BDiskDevice* device) +// #pragma mark - + + +void +MainWindow::_Mount(BDiskDevice* disk, partition_id selectedPartition) { - fPartitionList->AddPartition(device); + if (!disk || selectedPartition < 0) { + _DisplayPartitionError("You need to select a partition " + "entry from the list."); + return; + } -// printf("Visit(%p)\n", device); -// dump_partition_info(device); + BPartition* partition = disk->FindDescendant(selectedPartition); + if (!partition) { + _DisplayPartitionError("Unable to find the selected partition by id."); + return; + } - return false; // Don't stop yet! + if (!partition->IsMounted()) { + status_t ret = partition->Mount(); + if (ret < B_OK) { + _DisplayPartitionError("Could not mount partition %s.", + partition, ret); + } else { + // successful mount, adapt to the changes + _ScanDrives(); + } + } else { + _DisplayPartitionError("The partition %s is already mounted.", + partition); + } } -bool -DriveVisitor::Visit(BPartition* partition, int32 level) +void +MainWindow::_Unmount(BDiskDevice* disk, partition_id selectedPartition) { - fPartitionList->AddPartition(partition); + if (!disk || selectedPartition < 0) { + _DisplayPartitionError("You need to select a partition " + "entry from the list."); + return; + } -// printf("Visit(%p, %ld)\n", partition, level); -// dump_partition_info(partition); + BPartition* partition = disk->FindDescendant(selectedPartition); + if (!partition) { + _DisplayPartitionError("Unable to find the selected partition by id."); + return; + } - return false; // Don't stop yet! + if (partition->IsMounted()) { + status_t ret = partition->Unmount(); + if (ret < B_OK) { + _DisplayPartitionError("Could not unmount partition %s.", + partition, ret); + } else { + // successful unmount, adapt to the changes + _ScanDrives(); + } + } else { + _DisplayPartitionError("The partition %s is already unmounted.", + partition); + } } + + +void +MainWindow::_MountAll() +{ + MountAllVisitor visitor; + fDDRoster.VisitEachPartition(&visitor); +} + + +// #pragma mark - + + +void +MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition, + const BString& diskSystemName) +{ + if (!disk || selectedPartition < 0) { + _DisplayPartitionError("You need to select a partition " + "entry from the list."); + return; + } + + if (disk->IsReadOnly()) { + _DisplayPartitionError("The selected disk is read-only."); + return; + } + + BPartition* partition = disk->FindDescendant(selectedPartition); + if (!partition) { + _DisplayPartitionError("Unable to find the selected partition by id."); + return; + } + + if (partition->IsMounted()) { + _DisplayPartitionError("The partition %s is currently mounted."); + // TODO: option to unmount and continue on success to unmount + return; + } + + BString message("Are you sure you want to initialize the partition "); + message << "\"" << partition->ContentName(); + message << "\"? After entering the initialization parameters, "; + message << "you can abort this operation right before writing "; + message << "changes back to the disk."; + BAlert* alert = new BAlert("first notice", message.String(), + "Continue", "Cancel", NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT); + int32 choice = alert->Go(); + + if (choice == 1) + return; + + BDiskSystem diskSystem; + fDDRoster.RewindDiskSystems(); + bool found = false; + while (fDDRoster.GetNextDiskSystem(&diskSystem) == B_OK) { + if (diskSystem.IsFileSystem() && diskSystem.SupportsInitializing()) { + if (diskSystemName == diskSystem.PrettyName()) { + found = true; + break; + } + } + } + + if (!found) { + BString message("Disk system \""); + message << diskSystemName << "\" not found!"; + _DisplayPartitionError(message); + return; + } + + +// TODO: check and allow BFS only, since our parameter string +// construction only handles BFS at the moment +// if (BString("") != diskSystem) { +// } + + status_t ret = disk->PrepareModifications(); + if (ret != B_OK) { + _DisplayPartitionError("There was an error preparing the " + "disk for modifications.", NULL, ret); + return; + } + + // TODO: use partition initialization editor + // (partition->GetInitializationParameterEditor()) + + BString name = "BFS Init Test"; + BString parameters; + parameters << "block_size " << 2048 << "\n"; + + bool supportsName = diskSystem.SupportsContentName(); + BString validatedName(name); + ret = partition->ValidateInitialize(diskSystem.PrettyName(), + supportsName ? &validatedName : NULL, parameters.String()); + if (ret != B_OK) { + _DisplayPartitionError("Validation of the given initialization " + "parameters failed.", partition, ret); + return; + } + + BString previousName = partition->ContentName(); + + ret = partition->Initialize(diskSystem.PrettyName(), + supportsName ? name.String() : NULL, parameters.String()); + if (ret != B_OK) { + _DisplayPartitionError("Initialization of the partition %s " + "failed. (Nothing has been written to disk.)", partition, ret); + return; + } + + // everything looks fine, we are ready to actually write the changes + // to disk + + message = "Are you sure you want to write the changes back to " + "disk now?\n\n"; + message << "All data on the partition \"" << previousName; + message << "\" will be irrevertably lost if you do so!"; + alert = new BAlert("final notice", message.String(), + "Write Changes", "Cancel", NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT); + choice = alert->Go(); + + if (choice == 1) + return; + + // commit + ret = disk->CommitModifications(); + if (ret == B_OK) { + _DisplayPartitionError("The partition %s has been successfully " + "initialized.\n", partition); + } else { + _DisplayPartitionError("Failed to initialize the partition " + "%s!\n", partition, ret); + } +} + Modified: haiku/trunk/src/preferences/drivesetup/MainWindow.h =================================================================== --- haiku/trunk/src/preferences/drivesetup/MainWindow.h 2008-01-15 21:21:02 UTC (rev 23544) +++ haiku/trunk/src/preferences/drivesetup/MainWindow.h 2008-01-15 23:09:20 UTC (rev 23545) @@ -13,6 +13,7 @@ class BDiskDevice; class BPartition; class BMenu; +class BMenuItem; class DiskView; class PartitionListView; @@ -20,6 +21,7 @@ class MainWindow : public BWindow { public: MainWindow(BRect frame); + virtual ~MainWindow(); // BWindow interface virtual bool QuitRequested(); @@ -32,14 +34,49 @@ private: void _ScanDrives(); void _ScanFileSystems(); + void _AdaptToSelectedPartition(); + void _EnabledDisableMenuItems(BDiskDevice* disk, + partition_id selectedPartition); + void _DisplayPartitionError(BString message, + const BPartition* partition = NULL, + status_t error = B_OK) const; + void _Mount(BDiskDevice* disk, + partition_id selectedPartition); + void _Unmount(BDiskDevice* disk, + partition_id selectedPartition); + void _MountAll(); + + void _Initialize(BDiskDevice* disk, + partition_id selectedPartition, + const BString& diskSystemName); + + BDiskDeviceRoster fDDRoster; + BDiskDevice* fCurrentDisk; + partition_id fCurrentPartitionID; + PartitionListView* fListView; DiskView* fDiskView; + BMenu* fDiskMenu; + BMenu* fPartitionMenu; BMenu* fInitMenu; + BMenu* fCreateMenu; + + BMenuItem* fFormatMI; + BMenuItem* fEjectMI; + BMenuItem* fSurfaceTestMI; + BMenuItem* fRescanMI; + + BMenuItem* fCreatePrimaryMI; + BMenuItem* fCreateExtendedMI; + BMenuItem* fCreateLogicalMI; + BMenuItem* fMountMI; [... truncated: 82 lines follow ...] From bonefish at mail.berlios.de Wed Jan 16 01:01:22 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 16 Jan 2008 01:01:22 +0100 Subject: [Haiku-commits] r23546 - in haiku/trunk: headers/private/kernel src/system/kernel/debug Message-ID: <200801160001.m0G01M9L015693@sheep.berlios.de> Author: bonefish Date: 2008-01-16 01:01:20 +0100 (Wed, 16 Jan 2008) New Revision: 23546 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=23546&view=rev Added: haiku/trunk/src/system/kernel/debug/debug_commands.cpp haiku/trunk/src/system/kernel/debug/debug_commands.h haiku/trunk/src/system/kernel/debug/debug_parser.cpp haiku/trunk/src/system/kernel/debug/debug_variables.cpp haiku/trunk/src/system/kernel/debug/debug_variables.h Modified: haiku/trunk/headers/private/kernel/debug.h haiku/trunk/src/system/kernel/debug/Jamfile haiku/trunk/src/system/kernel/debug/debug.cpp Log: * Implemented parse_expression(). The back-end is an expression parser that is a little more powerful than BeOS'. It features: - Persistent and temporary uint64 variables. The former kind is set only by the user. The latter (those prefixed "_") can be set automatically by commands, thus e.g. making it easier to access members of a dumped structure. They are unset when the next command is invoked. The special temporary variable "_" is defined as a command's return value. - Expressions can contain nested command invocations using brackets ("[ ... ]"). - Command lines are parsed by the expression parser, too. They can contain command invocations (in brackets) and expressions (in parentheses). * Added debugger commands: - expr: Evaluates the given expression and prints the result. - unset: Undefines a variable. - vars: Prints the values of all defined variables. * Moved debugger command code into its own source file. Modified: haiku/trunk/headers/private/kernel/debug.h =================================================================== --- haiku/trunk/headers/private/kernel/debug.h 2008-01-15 23:09:20 UTC (rev 23545) +++ haiku/trunk/headers/private/kernel/debug.h 2008-01-16 00:01:20 UTC (rev 23546) @@ -59,8 +59,19 @@ extern void dprintf_no_syslog(const char *format, ...) __attribute__ ((format (__printf__, 1, 2))); -extern void _user_debug_output(const char *userString); +extern bool is_debug_variable_defined(const char* variableName); +extern bool set_debug_variable(const char* variableName, uint64 value); +extern uint64 get_debug_variable(const char* variableName, + uint64 defaultValue); +extern bool remove_debug_variable(const char* variableName); +extern void remove_all_temporary_debug_variables(); +extern bool evaluate_debug_expression(const char* expression, + uint64* result, bool silent); +extern int evaluate_debug_command(const char* command); + +extern void _user_debug_output(const char *userString); + #ifdef __cplusplus } #endif Modified: haiku/trunk/src/system/kernel/debug/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/debug/Jamfile 2008-01-15 23:09:20 UTC (rev 23545) +++ haiku/trunk/src/system/kernel/debug/Jamfile 2008-01-16 00:01:20 UTC (rev 23546) @@ -5,6 +5,9 @@ KernelMergeObject kernel_debug.o : blue_screen.cpp debug.cpp + debug_commands.cpp + debug_parser.cpp + debug_variables.cpp frame_buffer_console.cpp gdb.c tracing.cpp Modified: haiku/trunk/src/system/kernel/debug/debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.cpp 2008-01-15 23:09:20 UTC (rev 23545) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2008-01-16 00:01:20 UTC (rev 23546) @@ -28,26 +28,20 @@ #include #include -#include #include #include #include #include #include +#include "debug_commands.h" +#include "debug_variables.h" + static const char* const kKDLPrompt = "kdebug> "; extern "C" int kgets(char *buffer, int length); -static int invoke_command(struct debugger_command *command, int argc, - char** argv); -typedef struct debugger_command { - struct debugger_command *next; - int (*func)(int, char **); - const char *name; - const char *description; -} debugger_command; int dbg_register_file[B_MAX_CPU_COUNT][14]; /* XXXmpetit -- must be made generic */ @@ -66,11 +60,6 @@ static struct ring_buffer *sSyslogBuffer; static bool sSyslogDropped = false; -static struct debugger_command *sCommands; - -static jmp_buf sInvokeCommandEnv; -static bool sInvokeCommandDirectly = false; - static const char* sCurrentKernelDebuggerMessage; #define SYSLOG_BUFFER_SIZE 65536 @@ -97,52 +86,6 @@ #define distance(a, b) ((a) < (b) ? (b) - (a) : (a) - (b)) -static debugger_command* -next_command(debugger_command* command, const char* prefix, int prefixLen) -{ - if (command == NULL) - command = sCommands; - else - command = command->next; - - while (command != NULL && !strncmp(prefix, command->name, prefixLen) == 0) - command = command->next; - - return command; -} - - -static debugger_command * -find_command(const char *name, bool partialMatch, bool& ambiguous) -{ - debugger_command *command; - - ambiguous = false; - - // search command by full name - - for (command = sCommands; command != NULL; command = command->next) { - if (strcmp(name, command->name) == 0) - return command; - } - - // if it couldn't be found, search for a partial match - - if (partialMatch) { - int length = strlen(name); - command = next_command(NULL, name, length); - if (command != NULL) { - if (next_command(command, name, length) == NULL) - return command; - - ambiguous = true; - } - } - - return NULL; -} - - static void kputchar(char c) { @@ -256,14 +199,14 @@ tmpChar = *firstSpace; *firstSpace = '\0'; bool ambiguous; - debugger_command* command = find_command(buffer, true, ambiguous); + debugger_command* command = find_debugger_command(buffer, true, ambiguous); *firstSpace = tmpChar; if (command != NULL) { kputchar('\n'); char* args[3] = { NULL, "--help", NULL }; - invoke_command(command, 2, args); + invoke_debugger_command(command, 2, args); } else { if (ambiguous) kprintf("\nambiguous command\n"); @@ -281,7 +224,7 @@ debugger_command* command = NULL; int32 longestCommonPrefix = 0; const char* previousCommandName = NULL; - while ((command = next_command(command, buffer, position)) + while ((command = next_debugger_command(command, buffer, position)) != NULL) { count++; int32 nameLength = strlen(command->name); @@ -312,7 +255,7 @@ reprintLine = true; } else if (count == 1) { // exactly one completion - command = next_command(NULL, buffer, position); + command = next_debugger_command(NULL, buffer, position); // check for sufficient space in the buffer int32 neededSpace = longestName - position + 1; @@ -345,7 +288,7 @@ int columns = 80 / (longestName + 2); debugger_command* command = NULL; int column = 0; - while ((command = next_command(command, buffer, position)) + while ((command = next_debugger_command(command, buffer, position)) != NULL) { // spacing if (column > 0 && column % columns == 0) @@ -548,101 +491,6 @@ } -static int -parse_line(const char *buffer, char **argv, int *_argc, int32 maxArgs) -{ - char *string = sParseLine; - int32 index = 0; - - strcpy(string, buffer); - - for (; index < maxArgs && string[0]; index++) { - char quoted; - char c; - - // skip white space - while ((c = string[0]) != '\0' && isspace(c)) { - string++; - } - if (!c) - break; - - if (c == '\'' || c == '"') { - argv[index] = ++string; - quoted = c; - } else { - argv[index] = string; - quoted = 0; - } - - // find end of string - - while (string[0] - && ((quoted && string[0] != quoted) - || (!quoted && !isspace(string[0])))) { - if (string[0] == '\\') { - // filter out backslashes - strcpy(string, string + 1); - string++; - } - string++; - } - - if (string[0]) { - // terminate string - string[0] = '\0'; - string++; - } - } - - return *_argc = index; -} - - -/*! This function is a safe gate through which debugger commands are invoked. - It sets a fault handler before invoking the command, so that an invalid - memory access will not result in another KDL session on top of this one - (and "cont" not to work anymore). We use setjmp() + longjmp() to "unwind" - the stack after catching a fault. - */ -static int -invoke_command(struct debugger_command *command, int argc, char** argv) -{ - struct thread* thread = thread_get_current_thread(); - addr_t oldFaultHandler = thread->fault_handler; - - // replace argv[0] with the actual command name - argv[0] = (char *)command->name; - - // Invoking the command directly might be useful when debugging debugger - // commands. - if (sInvokeCommandDirectly) - return command->func(argc, argv); - - if (setjmp(sInvokeCommandEnv) == 0) { - int result; - thread->fault_handler = (addr_t)&&error; - // Fake goto to trick the compiler not to optimize the code at the label - // away. - if (!thread) - goto error; - - result = command->func(argc, argv); - thread->fault_handler = oldFaultHandler; - return result; - -error: - longjmp(sInvokeCommandEnv, 1); - // jump into the else branch - } else { - kprintf("\n[*** READ/WRITE FAULT ***]\n"); - } - - thread->fault_handler = oldFaultHandler; - return 0; -} - - static void kernel_debugger_loop(void) { @@ -652,45 +500,44 @@ kprintf("Welcome to Kernel Debugging Land...\n"); kprintf("Running on CPU %ld\n", sDebuggerOnCPU); - for (;;) { - struct debugger_command *cmd = NULL; - int argc; + int32 continuableLine = -1; + // Index of the previous command line, if the command returned + // B_KDEBUG_CONT, i.e. asked to be repeatable, -1 otherwise. + for (;;) { CommandLineEditingHelper editingHelper; kprintf(kKDLPrompt); - read_line(sLineBuffer[sCurrentLine], LINE_BUFFER_SIZE, &editingHelper); - parse_line(sLineBuffer[sCurrentLine], sArguments, &argc, MAX_ARGS); + char* line = sLineBuffer[sCurrentLine]; + read_line(line, LINE_BUFFER_SIZE, &editingHelper); - // We support calling last executed command again if - // B_KDEDUG_CONT was returned last time, so cmd != NULL - if (argc <= 0 && cmd == NULL) - continue; + // check, if the line is empty or whitespace only + bool whiteSpaceOnly = true; + for (int i = 0 ; line[i] != '\0'; i++) { + if (!isspace(line[i])) { + whiteSpaceOnly = false; + break; + } + } - sDebuggerOnCPU = smp_get_current_cpu(); + if (whiteSpaceOnly) { + if (continuableLine < 0) + continue; - bool ambiguous; - if (argc > 0) - cmd = find_command(sArguments[0], true, ambiguous); + // the previous command can be repeated + sCurrentLine = continuableLine; + line = sLineBuffer[sCurrentLine]; + } - if (cmd == NULL) { - if (ambiguous) { - kprintf("Ambiguous command. Use tab completion to get a list " - "of matching commands. Enter \"help\" to get a list of " - "all supported commands.\n"); - } else { - kprintf("Unknown command. Enter \"help\" to get a list of all " - "supported commands.\n"); - } - } else { - int rc = invoke_command(cmd, argc, sArguments); + sDebuggerOnCPU = smp_get_current_cpu(); - if (rc == B_KDEBUG_QUIT) - break; // okay, exit now. + int rc = evaluate_debug_command(line); - if (rc != B_KDEBUG_CONT) - cmd = NULL; // forget last command executed... - } + if (rc == B_KDEBUG_QUIT) + break; // okay, exit now. + // If the command is continuable, remember the current line index. + continuableLine = (rc == B_KDEBUG_CONT ? sCurrentLine : -1); + if (++sCurrentLine >= HISTORY_SIZE) sCurrentLine = 0; } @@ -725,7 +572,7 @@ bool ambiguous; if (argc > 1) { - specified = find_command(argv[1], false, ambiguous); + specified = find_debugger_command(argv[1], false, ambiguous); if (specified == NULL) { start = argv[1]; startLength = strlen(start); @@ -740,7 +587,8 @@ else kprintf("debugger commands:\n"); - for (command = sCommands; command != NULL; command = command->next) { + for (command = get_debugger_commands(); command != NULL; + command = command->next) { if (specified && command->func != specified->func) continue; if (start != NULL && strncmp(start, command->name, startLength)) @@ -771,7 +619,26 @@ return 0; } +static int +cmd_expr(int argc, char **argv) +{ + static const char* usage = "usage: expr \n" + "Evaluates the given expression and prints the result.\n"; + if (argc != 2 || strcmp(argv[1], "--help") == 0) { + kprintf(usage); + return 0; + } + uint64 result; + if (evaluate_debug_expression(argv[1], &result, false)) { + kprintf("%llu (0x%llx)\n", result, result); + set_debug_variable("_", result); + } + + return 0; +} + + static status_t syslog_sender(void *data) { @@ -1017,7 +884,10 @@ add_debugger_command("continue", &cmd_continue, "Leave kernel debugger"); add_debugger_command("message", &cmd_dump_kdl_message, "Reprint the message printed when entering KDL"); + add_debugger_command("expr", &cmd_expr, + "Evaluates the given expression and prints the result"); + debug_variables_init(); frame_buffer_console_init(args); arch_debug_console_init_settings(args); tracing_init(); @@ -1089,75 +959,11 @@ // #pragma mark - public API -int -add_debugger_command(char *name, int (*func)(int, char **), char *desc) -{ - cpu_status state; - struct debugger_command *cmd; - - cmd = (struct debugger_command *)malloc(sizeof(struct debugger_command)); - if (cmd == NULL) - return ENOMEM; - - cmd->func = func; - cmd->name = name; - cmd->description = desc; - - state = disable_interrupts(); - acquire_spinlock(&sSpinlock); - - cmd->next = sCommands; - sCommands = cmd; - - release_spinlock(&sSpinlock); - restore_interrupts(state); - - return B_NO_ERROR; -} - - -int -remove_debugger_command(char * name, int (*func)(int, char **)) -{ - struct debugger_command *cmd = sCommands; - struct debugger_command *prev = NULL; - cpu_status state; - - state = disable_interrupts(); - acquire_spinlock(&sSpinlock); - - while (cmd) { - if (!strcmp(cmd->name, name) && cmd->func == func) - break; - - prev = cmd; - cmd = cmd->next; - } - - if (cmd) { - if (cmd == sCommands) - sCommands = cmd->next; - else - prev->next = cmd->next; - } - - release_spinlock(&sSpinlock); - restore_interrupts(state); - - if (cmd) { - free(cmd); - return B_NO_ERROR; - } - - return B_NAME_NOT_FOUND; -} - - uint32 parse_expression(const char *expression) { - // TODO: Implement expression parser (cf. BeBook). - return strtoul(expression, NULL, 0); + uint64 result; + return (evaluate_debug_expression(expression, &result, true) ? result : 0); } @@ -1207,28 +1013,9 @@ sCurrentKernelDebuggerMessage = message; - // bubble sort the commands - debugger_command* stopCommand = NULL; - while (stopCommand != sCommands) { - debugger_command** command = &sCommands; - while (true) { - debugger_command* nextCommand = (*command)->next; - if (nextCommand == stopCommand) { - stopCommand = *command; - break; - } + // sort the commands + sort_debugger_commands(); - if (strcmp((*command)->name, nextCommand->name) > 0) { - debugger_command* tmpCommand = nextCommand->next; - (*command)->next = nextCommand->next; - nextCommand->next = *command; - *command = nextCommand; - } - - command = &(*command)->next; - } - } - kernel_debugger_loop(); set_dprintf_enabled(dprintfState); Added: haiku/trunk/src/system/kernel/debug/debug_commands.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2008-01-15 23:09:20 UTC (rev 23545) +++ haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2008-01-16 00:01:20 UTC (rev 23546) @@ -0,0 +1,225 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de + * Copyright 2002-2007, Axel D?rfler, axeld at pinc-software.de + * Distributed under the terms of the MIT License. + * + * Copyright 2001, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ + +#include "debug_commands.h" + +#include +#include + +#include + +#include +#include +#include + +#include "debug_variables.h" + + +static spinlock sSpinlock = 0; + +static struct debugger_command *sCommands; + +static jmp_buf sInvokeCommandEnv; +static bool sInvokeCommandDirectly = false; + + +debugger_command* +next_debugger_command(debugger_command* command, const char* prefix, int prefixLen) +{ + if (command == NULL) + command = sCommands; + else + command = command->next; + + while (command != NULL && !strncmp(prefix, command->name, prefixLen) == 0) + command = command->next; + + return command; +} + + +debugger_command * +find_debugger_command(const char *name, bool partialMatch, bool& ambiguous) +{ + debugger_command *command; + + ambiguous = false; + + // search command by full name + + for (command = sCommands; command != NULL; command = command->next) { + if (strcmp(name, command->name) == 0) + return command; + } + + // if it couldn't be found, search for a partial match + + if (partialMatch) { + int length = strlen(name); + command = next_debugger_command(NULL, name, length); + if (command != NULL) { + if (next_debugger_command(command, name, length) == NULL) + return command; + + ambiguous = true; + } + } + + return NULL; +} + + +/*! This function is a safe gate through which debugger commands are invoked. + It sets a fault handler before invoking the command, so that an invalid + memory access will not result in another KDL session on top of this one + (and "cont" not to work anymore). We use setjmp() + longjmp() to "unwind" + the stack after catching a fault. + */ +int +invoke_debugger_command(struct debugger_command *command, int argc, char** argv) +{ + // remove the temporary variables of the previously executed command, if + // this command sets a temporary variable + mark_temporary_debug_variables_obsolete(); + + struct thread* thread = thread_get_current_thread(); + addr_t oldFaultHandler = thread->fault_handler; + + // replace argv[0] with the actual command name + argv[0] = (char *)command->name; + + // Invoking the command directly might be useful when debugging debugger + // commands. + if (sInvokeCommandDirectly) + return command->func(argc, argv); + + if (setjmp(sInvokeCommandEnv) == 0) { + int result; + thread->fault_handler = (addr_t)&&error; + // Fake goto to trick the compiler not to optimize the code at the label + // away. + if (!thread) + goto error; + + result = command->func(argc, argv); + thread->fault_handler = oldFaultHandler; + return result; + +error: + longjmp(sInvokeCommandEnv, 1); + // jump into the else branch + } else { + kprintf("\n[*** READ/WRITE FAULT ***]\n"); + } + + thread->fault_handler = oldFaultHandler; + return 0; +} + + +debugger_command* +get_debugger_commands() +{ + return sCommands; +} + + +void +sort_debugger_commands() +{ + // bubble sort the commands + debugger_command* stopCommand = NULL; + while (stopCommand != sCommands) { + debugger_command** command = &sCommands; + while (true) { + debugger_command* nextCommand = (*command)->next; + if (nextCommand == stopCommand) { + stopCommand = *command; + break; + } + + if (strcmp((*command)->name, nextCommand->name) > 0) { + debugger_command* tmpCommand = nextCommand->next; + (*command)->next = nextCommand->next; + nextCommand->next = *command; + *command = nextCommand; + } + + command = &(*command)->next; + } + } +} + + +// #pragma mark - public API + + +int +add_debugger_command(char *name, int (*func)(int, char **), char *desc) +{ + cpu_status state; + struct debugger_command *cmd; + + cmd = (struct debugger_command *)malloc(sizeof(struct debugger_command)); + if (cmd == NULL) + return ENOMEM; + + cmd->func = func; + cmd->name = name; + cmd->description = desc; + + state = disable_interrupts(); + acquire_spinlock(&sSpinlock); + + cmd->next = sCommands; + sCommands = cmd; + + release_spinlock(&sSpinlock); + restore_interrupts(state); + + return B_NO_ERROR; +} + + +int +remove_debugger_command(char * name, int (*func)(int, char **)) +{ + struct debugger_command *cmd = sCommands; + struct debugger_command *prev = NULL; + cpu_status state; + + state = disable_interrupts(); + acquire_spinlock(&sSpinlock); + + while (cmd) { + if (!strcmp(cmd->name, name) && cmd->func == func) + break; + + prev = cmd; + cmd = cmd->next; + } + + if (cmd) { + if (cmd == sCommands) + sCommands = cmd->next; + else + prev->next = cmd->next; + } + + release_spinlock(&sSpinlock); + restore_interrupts(state); + + if (cmd) { + free(cmd); + return B_NO_ERROR; + } + + return B_NAME_NOT_FOUND; +} + Added: haiku/trunk/src/system/kernel/debug/debug_commands.h =================================================================== --- haiku/trunk/src/system/kernel/debug/debug_commands.h 2008-01-15 23:09:20 UTC (rev 23545) +++ haiku/trunk/src/system/kernel/debug/debug_commands.h 2008-01-16 00:01:20 UTC (rev 23546) @@ -0,0 +1,38 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de + * Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_DEBUG_COMMANDS_H +#define _KERNEL_DEBUG_COMMANDS_H + + +#include + + +struct debugger_command { + struct debugger_command *next; + int (*func)(int, char **); + const char *name; + const char *description; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +debugger_command* next_debugger_command(debugger_command* command, + const char* prefix, int prefixLen); +debugger_command* find_debugger_command(const char* name, bool partialMatch, + bool& ambiguous); +int invoke_debugger_command(struct debugger_command *command, int argc, + char** argv); + +debugger_command* get_debugger_commands(); +void sort_debugger_commands(); + +#ifdef __cplusplus +} // extern "C" +#endif + + +#endif // _KERNEL_DEBUG_COMMANDS_H Added: haiku/trunk/src/system/kernel/debug/debug_parser.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug_parser.cpp 2008-01-15 23:09:20 UTC (rev 23545) +++ haiku/trunk/src/system/kernel/debug/debug_parser.cpp 2008-01-16 00:01:20 UTC (rev 23546) @@ -0,0 +1,929 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de + * Copyright 2006, Stephan A?mus, superstippi at gmx.de + * Distributed under the terms of the MIT License. + */ + +#include + +#include +#include +#include +#include +#include + +#include + +#include "debug_commands.h" +#include "debug_variables.h" + + +/* + Grammar: + + commandLine := command | ( "(" expression ")" ) + expression := term | assignment + assignment := variable ( "=" | "+=" | "-=" | "*=" | "/=" | "%=" ) + expression + term := sum + sum := product ( ( "+" | "-" ) product )* + product := unary ( ( "*" | "/" | "%" ) unary )* + unary := [ "-" ] atom + atom := variable | ( "(" expression ")" ) | ( "[" command "]" ) + variable := identifier + identifier := ( "_" | "a" - "z" | "A" - "Z" ) + ( "_" | "a" - "z" | "A" - "Z" | "0" - "9" )* + command := identifier argument* + argument := ( "(" expression ")" ) | ( "[" commandLine "]" ) + | unquotedString | quotedString +*/ + + +static const int kMaxTokenLength = 128; +static const int kJumpBufferCount = 10; + +static const int kMaxArgumentCount = 16; +static const size_t kTemporaryStorageSize = 10240; + +static jmp_buf sJumpBuffers[kJumpBufferCount]; +static int sNextJumpBufferIndex = 0; + +static char sExceptionMessage[128]; +static int sExceptionPosition; + +static char sTempBuffer[128]; + // for composing debug output etc. + +// temporary storage for command argument vectors and the arguments itself +static uint8 sTemporaryStorage[kTemporaryStorageSize]; +static size_t sTemporaryStorageUsed = 0; + +enum { + TOKEN_ASSIGN_FLAG = 0x100, + TOKEN_FLAGS = TOKEN_ASSIGN_FLAG, + + TOKEN_IDENTIFIER = 'a', + + TOKEN_CONSTANT = '0', + + TOKEN_PLUS = '+', + TOKEN_MINUS = '-', + + TOKEN_STAR = '*', + TOKEN_SLASH = '/', + TOKEN_MODULO = '%', + + TOKEN_ASSIGN = '=' | TOKEN_ASSIGN_FLAG, + TOKEN_PLUS_ASSIGN = TOKEN_PLUS | TOKEN_ASSIGN_FLAG, + TOKEN_MINUS_ASSIGN = TOKEN_MINUS | TOKEN_ASSIGN_FLAG, + TOKEN_STAR_ASSIGN = TOKEN_STAR | TOKEN_ASSIGN_FLAG, + TOKEN_SLASH_ASSIGN = TOKEN_SLASH | TOKEN_ASSIGN_FLAG, + TOKEN_MODULO_ASSIGN = TOKEN_MODULO | TOKEN_ASSIGN_FLAG, + + TOKEN_OPENING_PARENTHESIS = '(', + TOKEN_CLOSING_PARENTHESIS = ')', + TOKEN_OPENING_BRACKET = '[', + TOKEN_CLOSING_BRACKET = ']', + + TOKEN_STRING = '"', + TOKEN_UNKNOWN = '?', + TOKEN_NONE = ' ', + TOKEN_END_OF_LINE = '\n', +}; + +struct Token { + char string[kMaxTokenLength]; + uint64 value; + int32 type; + int32 position; + + void SetTo(const char* string, int32 length, int32 position, int32 type) + { + length = min_c((size_t)length, (sizeof(this->string) - 1)); + strlcpy(this->string, string, length + 1); + this->type = type; + this->value = 0; + this->position = position; + } + + void Unset() + { + string[0] = '\0'; + value = 0; + type = TOKEN_NONE; + position = 0; + } +}; + + +// #pragma mark - exceptions + + +static void +parse_exception(const char* message, int32 position) +{ + if (sNextJumpBufferIndex == 0) { + kprintf("parse_exception(): No jump buffer!\n"); + kprintf("exception: \"%s\", position: %lu\n", message, position); + return; + } + + strlcpy(sExceptionMessage, message, sizeof(sExceptionMessage)); + sExceptionPosition = position; + + longjmp(sJumpBuffers[sNextJumpBufferIndex - 1], 1); +} + + +// #pragma mark - temporary storage + + +static void* +allocate_temp_storage(size_t size) +{ + // 8 byte align + size = (size + 7) & ~7; + + if (sTemporaryStorageUsed + size > kTemporaryStorageSize) { + parse_exception("out of temporary storage for command execution", -1); + return NULL; + } + + void* buffer = sTemporaryStorage + sTemporaryStorageUsed; + sTemporaryStorageUsed += size; + + return buffer; +} + + +static void +free_temp_storage(void* _buffer) +{ + uint8* buffer = (uint8*)_buffer; + + if (buffer == NULL) + return; + + // must be freed in the reverse allocation order + if (buffer < sTemporaryStorage + || buffer > sTemporaryStorage + sTemporaryStorageUsed) { + panic("Invalid pointer passed to free_temp_storage(): %p, temp " + "storage base: %p", buffer, sTemporaryStorage); + return; + } + + sTemporaryStorageUsed = buffer - sTemporaryStorage; +} + + +// #pragma mark - Tokenizer + + +class Tokenizer { +public: + Tokenizer(const char* string) + : fCommandMode(false) + { + SetTo(string); + } + + void SetTo(const char* string) + { + fString = fCurrentCha