Fixed up network stack and drivers for x86_64.

* Various compilation fixes.
* Fixes to the FreeBSD compatibility layer (from comparing the x86-
  specific bits with the equivalent amd64 sources in FreeBSD).
* Compile all the Ethernet drivers except for sis900 and wb840, these
  require a bit more work to fix (will file a ticket soon). Tested
  ipro1000 and rtl81xx, no issues.
This commit is contained in:
Alex Smith 2012-08-10 14:30:54 +01:00
parent 2b861dd2a5
commit 6d796a84bd
30 changed files with 164 additions and 103 deletions

View File

@ -24,15 +24,15 @@ SYSTEM_BIN = "[" addattr base64 basename bash beep cal cat catattr chgrp chmod
copyattr cp csplit cut date dd diff diff3 dircolors dirname df du copyattr cp csplit cut date dd diff diff3 dircolors dirname df du
dumpcatalog echo eject env error expand expr factor false find finddir dumpcatalog echo eject env error expand expr factor false find finddir
fmt fold fortune gawk gdb gzip gzexe getlimits groups head hostname id fmt fold fortune gawk gdb gzip gzexe getlimits groups head hostname id
<bin>install isvolume join kernel_debugger kill less lessecho lesskey link ifconfig <bin>install isvolume join kernel_debugger kill less lessecho
linkcatkeys listdev ln locale locate logger logname ls md5sum mkdir mkfifo lesskey link linkcatkeys listdev ln locale locate logger logname ls md5sum
mktemp mount mountvolume mv nl nohup nproc od paste patch pathchk pr mkdir mkfifo mktemp mount mountvolume mv nl nohup nproc od paste patch
printenv printf ps ptx pwd readlink ReadOnlyBootPrompt rm rmattr rmdir pathchk ping pr printenv printf ps ptx pwd readlink ReadOnlyBootPrompt rm
safemode sdiff seq sha1sum shred shuf sleep sort split stat strace stty su rmattr rmdir safemode sdiff seq sha1sum shred shuf sleep sort split stat
sum sync sysinfo tac tail tee test timeout touch tr true truncate tsort tty strace stty su sum sync sysinfo tac tail tee test timeout touch tr true
unexpand uname uniq unlink unmount unzip <bin>updatedb waitfor wc whoami truncate tsort tty unexpand uname uniq unlink unmount unzip <bin>updatedb
xargs xres yes zdiff zforce zgrep zip zipcloak <bin>zipgrep zipnote waitfor wc wget whoami xargs xres yes zdiff zforce zgrep zip zipcloak
zipsplit zmore znew <bin>zipgrep zipnote zipsplit zmore znew
; ;
SYSTEM_APPS = AboutSystem Terminal ; SYSTEM_APPS = AboutSystem Terminal ;
@ -55,9 +55,14 @@ SYSTEM_LIBS = libbe.so libbnetapi.so libdebug.so libjpeg.so libnetwork.so
PRIVATE_SYSTEM_LIBS = libilmimf.so ; PRIVATE_SYSTEM_LIBS = libilmimf.so ;
SYSTEM_SERVERS = app_server debug_server input_server mount_server SYSTEM_SERVERS = app_server debug_server input_server mount_server
notification_server registrar syslog_daemon net_server notification_server registrar syslog_daemon
; ;
SYSTEM_NETWORK_DEVICES = ethernet loopback ;
SYSTEM_NETWORK_DATALINK_PROTOCOLS = ethernet_frame <module>arp loopback_frame
ipv6_datagram ;
SYSTEM_NETWORK_PROTOCOLS = ipv4 tcp udp icmp unix icmp6 ipv6 ;
SYSTEM_ADD_ONS_ACCELERANTS = vesa.accelerant ; SYSTEM_ADD_ONS_ACCELERANTS = vesa.accelerant ;
SYSTEM_ADD_ONS_TRANSLATORS = BMPTranslator EXRTranslator GIFTranslator SYSTEM_ADD_ONS_TRANSLATORS = BMPTranslator EXRTranslator GIFTranslator
HVIFTranslator ICOTranslator JPEGTranslator JPEG2000Translator HVIFTranslator ICOTranslator JPEGTranslator JPEG2000Translator
@ -67,6 +72,11 @@ SYSTEM_ADD_ONS_TRANSLATORS = BMPTranslator EXRTranslator GIFTranslator
; ;
SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = vesa ; SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = vesa ;
SYSTEM_ADD_ONS_DRIVERS_NET = 3com atheros813x ar81xx attansic_l1 attansic_l2
broadcom440x broadcom570x dec21xxx etherpci ipro100 ipro1000 jmicron2x0
marvell_yukon nforce pcnet pegasus rtl8139 rtl81xx sis19x syskonnect
via_rhine
;
SYSTEM_ADD_ONS_BUS_MANAGERS = $(ATA_ONLY)ata pci ps2 isa scsi config_manager SYSTEM_ADD_ONS_BUS_MANAGERS = $(ATA_ONLY)ata pci ps2 isa scsi config_manager
usb ; usb ;
@ -105,6 +115,7 @@ AddDriversToHaikuImage : console dprintf null
AddDriversToHaikuImage graphics : $(SYSTEM_ADD_ONS_DRIVERS_GRAPHICS) ; AddDriversToHaikuImage graphics : $(SYSTEM_ADD_ONS_DRIVERS_GRAPHICS) ;
AddDriversToHaikuImage disk usb : usb_disk ; AddDriversToHaikuImage disk usb : usb_disk ;
AddDriversToHaikuImage input : ps2_hid usb_hid ; AddDriversToHaikuImage input : ps2_hid usb_hid ;
AddDriversToHaikuImage net : $(SYSTEM_ADD_ONS_DRIVERS_NET) ;
# kernel # kernel
AddFilesToHaikuImage system : kernel_$(TARGET_ARCH) ; AddFilesToHaikuImage system : kernel_$(TARGET_ARCH) ;
@ -310,6 +321,14 @@ AddFilesToHaikuHybridImage system add-ons Translators
: $(SYSTEM_ADD_ONS_TRANSLATORS) : : true ; : $(SYSTEM_ADD_ONS_TRANSLATORS) : : true ;
AddFilesToHaikuImage system add-ons input_server devices AddFilesToHaikuImage system add-ons input_server devices
: <input>keyboard <input>mouse <input>tablet <input>wacom ; : <input>keyboard <input>mouse <input>tablet <input>wacom ;
AddFilesToHaikuImage system add-ons kernel network
: <net>notifications stack ;
AddFilesToHaikuImage system add-ons kernel network devices
: $(SYSTEM_NETWORK_DEVICES) ;
AddFilesToHaikuImage system add-ons kernel network datalink_protocols
: $(SYSTEM_NETWORK_DATALINK_PROTOCOLS) ;
AddFilesToHaikuImage system add-ons kernel network protocols
: $(SYSTEM_NETWORK_PROTOCOLS) ;
# create directories that will remain empty # create directories that will remain empty
AddDirectoryToHaikuImage common bin ; AddDirectoryToHaikuImage common bin ;

View File

@ -85,9 +85,9 @@ struct net_buffer_module_info {
status_t (*direct_access)(net_buffer* buffer, uint32 offset, status_t (*direct_access)(net_buffer* buffer, uint32 offset,
size_t bytes, void** _data); size_t bytes, void** _data);
status_t (*read)(net_buffer* buffer, uint32 offset, void* data, status_t (*read)(net_buffer* buffer, size_t offset, void* data,
size_t bytes); size_t bytes);
status_t (*write)(net_buffer* buffer, uint32 offset, status_t (*write)(net_buffer* buffer, size_t offset,
const void* data, size_t bytes); const void* data, size_t bytes);
int32 (*checksum)(net_buffer* buffer, uint32 offset, size_t bytes, int32 (*checksum)(net_buffer* buffer, uint32 offset, size_t bytes,

View File

@ -370,10 +370,10 @@ output_count(etherpci_private_t *data)
/* /*
* How many waiting for input? * How many waiting for input?
*/ */
static long static int32
input_count(etherpci_private_t *data) input_count(etherpci_private_t *data)
{ {
long count; int32 count;
get_sem_count(data->ilock, &count); get_sem_count(data->ilock, &count);
return (count); return (count);
@ -1207,7 +1207,7 @@ enable_addressing(etherpci_private_t *data)
data->reg_base = data->reg_base + offset; data->reg_base = data->reg_base + offset;
#endif #endif
dprintf(kDevName ": reg_base=%lx\n", data->reg_base); dprintf(kDevName ": reg_base=%" B_PRIx32 "\n", data->reg_base);
/* enable pci address access */ /* enable pci address access */
cmd = (gPCIModInfo->read_pci_config)(data->pciInfo->bus, data->pciInfo->device, data->pciInfo->function, PCI_command, 2); cmd = (gPCIModInfo->read_pci_config)(data->pciInfo->bus, data->pciInfo->device, data->pciInfo->function, PCI_command, 2);
@ -1377,7 +1377,7 @@ init_driver(void)
/* Create device name list*/ /* Create device name list*/
for (i=0; i<entries; i++ ) for (i=0; i<entries; i++ )
{ {
sprintf(devName, "%s%ld", kDevDir, i ); sprintf(devName, "%s%" B_PRId32, kDevDir, i );
gDevNameList[i] = (char *)malloc(strlen(devName)+1); gDevNameList[i] = (char *)malloc(strlen(devName)+1);
strcpy(gDevNameList[i], devName); strcpy(gDevNameList[i], devName);
} }

View File

@ -186,14 +186,14 @@ create_device(const usb_device dev, const usb_interface_info *ii, uint16 ifno)
device->sem_lock = sem = create_sem(1, DRIVER_NAME "_lock"); device->sem_lock = sem = create_sem(1, DRIVER_NAME "_lock");
if (sem < B_OK) { if (sem < B_OK) {
DPRINTF_ERR("create_sem() failed 0x%lx\n", sem); DPRINTF_ERR("create_sem() failed 0x%" B_PRIx32 "\n", sem);
free(device); free(device);
return NULL; return NULL;
} }
device->rx_sem = sem = create_sem(1, DRIVER_NAME"_receive"); device->rx_sem = sem = create_sem(1, DRIVER_NAME"_receive");
if (sem < B_OK) { if (sem < B_OK) {
DPRINTF_ERR("create_sem() failed 0x%lx\n", sem); DPRINTF_ERR("create_sem() failed 0x%" B_PRIx32 "\n", sem);
delete_sem(device->sem_lock); delete_sem(device->sem_lock);
free(device); free(device);
return NULL; return NULL;
@ -202,7 +202,7 @@ create_device(const usb_device dev, const usb_interface_info *ii, uint16 ifno)
device->rx_sem_cb = sem = create_sem(0, DRIVER_NAME"_receive_cb"); device->rx_sem_cb = sem = create_sem(0, DRIVER_NAME"_receive_cb");
if (sem < B_OK) { if (sem < B_OK) {
DPRINTF_ERR("create_sem() failed 0x%lx\n", sem); DPRINTF_ERR("create_sem() failed 0x%" B_PRIx32 "\n", sem);
delete_sem(device->rx_sem); delete_sem(device->rx_sem);
delete_sem(device->sem_lock); delete_sem(device->sem_lock);
free(device); free(device);
@ -499,7 +499,7 @@ pegasus_device_read(driver_cookie *cookie, off_t position, void *buffer, size_t
// block until receive is available (if blocking is allowed) // block until receive is available (if blocking is allowed)
if ((status = acquire_sem_etc(dev->rx_sem, 1, B_CAN_INTERRUPT | blockFlag, 0)) != B_NO_ERROR) { if ((status = acquire_sem_etc(dev->rx_sem, 1, B_CAN_INTERRUPT | blockFlag, 0)) != B_NO_ERROR) {
DPRINTF_ERR("cannot acquire read sem: %lx, %s\n", status, strerror(status)); DPRINTF_ERR("cannot acquire read sem: %" B_PRIx32 ", %s\n", status, strerror(status));
#ifndef __HAIKU__ #ifndef __HAIKU__
*_length = 0; *_length = 0;
#endif #endif
@ -510,13 +510,13 @@ pegasus_device_read(driver_cookie *cookie, off_t position, void *buffer, size_t
status = usb->queue_bulk(dev->pipe_in, dev->rx_buffer, MAX_FRAME_SIZE, &pegasus_rx_callback, dev); status = usb->queue_bulk(dev->pipe_in, dev->rx_buffer, MAX_FRAME_SIZE, &pegasus_rx_callback, dev);
if (status != B_OK) { if (status != B_OK) {
DPRINTF_ERR("queue_bulk:failed:%08lx\n", status); DPRINTF_ERR("queue_bulk:failed:%08" B_PRIx32 "\n", status);
goto rx_done; goto rx_done;
} }
// block until data is available (if blocking is allowed) // block until data is available (if blocking is allowed)
if ((status = acquire_sem_etc(dev->rx_sem_cb, 1, B_CAN_INTERRUPT | blockFlag, 0)) != B_NO_ERROR) { if ((status = acquire_sem_etc(dev->rx_sem_cb, 1, B_CAN_INTERRUPT | blockFlag, 0)) != B_NO_ERROR) {
DPRINTF_ERR("cannot acquire read sem: %lx, %s\n", status, strerror(status)); DPRINTF_ERR("cannot acquire read sem: %" B_PRIx32 ", %s\n", status, strerror(status));
#ifndef __HAIKU__ #ifndef __HAIKU__
*_length = 0; *_length = 0;
#endif #endif
@ -567,7 +567,7 @@ pegasus_device_write(driver_cookie *cookie, off_t position, const void *buffer,
// block until a free tx descriptor is available // block until a free tx descriptor is available
if ((status = acquire_sem_etc(dev->tx_sem, 1, B_TIMEOUT, ETHER_TRANSMIT_TIMEOUT)) < B_NO_ERROR) { if ((status = acquire_sem_etc(dev->tx_sem, 1, B_TIMEOUT, ETHER_TRANSMIT_TIMEOUT)) < B_NO_ERROR) {
DPRINTF_ERR("write: acquiring sem failed: %lx, %s\n", status, strerror(status)); DPRINTF_ERR("write: acquiring sem failed: %" B_PRIx32 ", %s\n", status, strerror(status));
return status; return status;
} }
@ -594,13 +594,13 @@ pegasus_device_write(driver_cookie *cookie, off_t position, const void *buffer,
&pegasus_tx_callback, dev); &pegasus_tx_callback, dev);
if (status != B_OK){ if (status != B_OK){
DPRINTF_ERR("queue_bulk:failed:%08lx\n", status); DPRINTF_ERR("queue_bulk:failed:%08" B_PRIx32 "\n", status);
goto tx_done; goto tx_done;
} }
// block until data is sent (if blocking is allowed) // block until data is sent (if blocking is allowed)
if ((status = acquire_sem_etc(dev->tx_sem_cb, 1, B_CAN_INTERRUPT, 0)) != B_NO_ERROR) { if ((status = acquire_sem_etc(dev->tx_sem_cb, 1, B_CAN_INTERRUPT, 0)) != B_NO_ERROR) {
DPRINTF_ERR("cannot acquire write done sem: %lx, %s\n", status, strerror(status)); DPRINTF_ERR("cannot acquire write done sem: %" B_PRIx32 ", %s\n", status, strerror(status));
#ifndef __HAIKU__ #ifndef __HAIKU__
*_length = 0; *_length = 0;
#endif #endif

View File

@ -197,8 +197,8 @@ DataRing<TxDescriptor, TxDescriptorsCount>::Dump()
{ {
int32 count = 0; int32 count = 0;
get_sem_count(fSemaphore, &count); get_sem_count(fSemaphore, &count);
kprintf("Tx:[count:%ld] head:%lu tail:%lu dirty:%lu\n", kprintf("Tx:[count:%" B_PRId32 "] head:%" B_PRIu32 " tail:%" B_PRIu32 " "
count, fHead, fTail, fHead - fTail); "dirty:%" B_PRIu32 "\n", count, fHead, fTail, fHead - fTail);
kprintf("\tPktSize\t\tCmdStat\t\tBufPtr\t\tEOD\n"); kprintf("\tPktSize\t\tCmdStat\t\tBufPtr\t\tEOD\n");
@ -206,8 +206,9 @@ DataRing<TxDescriptor, TxDescriptorsCount>::Dump()
volatile TxDescriptor& D = fDescriptors[i]; volatile TxDescriptor& D = fDescriptors[i];
char marker = ((fTail % TxDescriptorsCount) == i) ? '=' : ' '; char marker = ((fTail % TxDescriptorsCount) == i) ? '=' : ' ';
marker = ((fHead % TxDescriptorsCount) == i) ? '>' : marker; marker = ((fHead % TxDescriptorsCount) == i) ? '>' : marker;
kprintf("%02lx %c\t%08lx\t%08lx\t%08lx\t%08lx\n", i, marker, kprintf("%02lx %c\t%08" B_PRIx32 "\t%08" B_PRIx32 "\t%08" B_PRIx32
D.fPacketSize, D.fCommandStatus, D.fBufferPointer, D.fEOD); "\t%08" B_PRIx32 "\n", i, marker, D.fPacketSize,
D.fCommandStatus, D.fBufferPointer, D.fEOD);
} }
} }
@ -335,8 +336,8 @@ DataRing<RxDescriptor, RxDescriptorsCount>::Dump()
{ {
int32 count = 0; int32 count = 0;
get_sem_count(fSemaphore, &count); get_sem_count(fSemaphore, &count);
kprintf("Rx:[count:%ld] head:%lu tail:%lu dirty:%lu\n", kprintf("Rx:[count:%" B_PRId32 "] head:%" B_PRIu32 " tail:%" B_PRIu32 " "
count, fHead, fTail, fHead - fTail); "dirty:%" B_PRIu32 "\n", count, fHead, fTail, fHead - fTail);
for (size_t i = 0; i < 2; i++) { for (size_t i = 0; i < 2; i++) {
kprintf("\tStatSize\tPktInfo\t\tBufPtr\t\tEOD %c", kprintf("\tStatSize\tPktInfo\t\tBufPtr\t\tEOD %c",
@ -344,7 +345,8 @@ DataRing<RxDescriptor, RxDescriptorsCount>::Dump()
} }
for (size_t i = 0; i < RxDescriptorsCount / 2; i++) { for (size_t i = 0; i < RxDescriptorsCount / 2; i++) {
const char* mask = "%02lx %c\t%08lx\t%08lx\t%08lx\t%08lx %c"; const char* mask = "%02" B_PRIx32 " %c\t%08" B_PRIx32 "\t%08" B_PRIx32
"\t%08" B_PRIx32 "\t%08" B_PRIx32 " %c";
for (size_t ii = 0; ii < 2; ii++) { for (size_t ii = 0; ii < 2; ii++) {
size_t index = ii == 0 ? i : (i + RxDescriptorsCount / 2); size_t index = ii == 0 ? i : (i + RxDescriptorsCount / 2);

View File

@ -736,7 +736,8 @@ Device::DumpRegisters()
for (size_t i = 0; i < _countof(RegisterEntries); i++) { for (size_t i = 0; i < _countof(RegisterEntries); i++) {
uint32 registerContents = ReadPCI32(RegisterEntries[i].Base); uint32 registerContents = ReadPCI32(RegisterEntries[i].Base);
kprintf("%s:\t%08lx\n", RegisterEntries[i].Name, registerContents); kprintf("%s:\t%08" B_PRIx32 "\n", RegisterEntries[i].Name,
registerContents);
if (RegisterEntries[i].writeBack) { if (RegisterEntries[i].writeBack) {
WritePCI32(RegisterEntries[i].Base, registerContents); WritePCI32(RegisterEntries[i].Base, registerContents);
} }

View File

@ -83,7 +83,7 @@ static int SiS19X_DebuggerCommand(int argc, char** argv)
} }
if (cardId >= numCards) { if (cardId >= numCards) {
kprintf("%lld - invalid index.\n", cardId); kprintf("%" B_PRId64 " - invalid index.\n", cardId);
kprintf(usageInfo); kprintf(usageInfo);
return 0; return 0;
} }

View File

@ -101,7 +101,7 @@ void SiS19X_trace(bool force, const char* func, const char *fmt, ...)
bigtime_t time = system_time(); bigtime_t time = system_time();
uint32 msec = time / 1000; uint32 msec = time / 1000;
uint32 sec = msec / 1000; uint32 sec = msec / 1000;
sprintf(buf_ptr, "%02ld.%02ld.%03ld:", sprintf(buf_ptr, "%02" B_PRId32 ".%02" B_PRId32 ".%03" B_PRId32 ":",
sec / 60, sec % 60, msec % 1000); sec / 60, sec % 60, msec % 1000);
buf_ptr += strlen(buf_ptr); buf_ptr += strlen(buf_ptr);
} }

View File

@ -218,7 +218,8 @@ get_domain(struct net_buffer* buffer)
status_t status_t
icmp6_receive_data(net_buffer *buffer) icmp6_receive_data(net_buffer *buffer)
{ {
TRACE(("ICMPv6 received some data, buffer length %lu\n", buffer->size)); TRACE(("ICMPv6 received some data, buffer length %" B_PRIu32 "\n",
buffer->size));
net_domain* domain = get_domain(buffer); net_domain* domain = get_domain(buffer);
if (domain == NULL) if (domain == NULL)

View File

@ -310,8 +310,8 @@ BufferQueue::Get(net_buffer *buffer, tcp_sequence sequence, size_t bytes)
if (source == NULL) if (source == NULL)
panic("we should have had that data..."); panic("we should have had that data...");
if (tcp_sequence(source->sequence) > sequence) { if (tcp_sequence(source->sequence) > sequence) {
panic("source %p, sequence = %lu (%lu)\n", source, source->sequence, panic("source %p, sequence = %" B_PRIu32 " (%" B_PRIu32 ")\n", source,
sequence.Number()); source->sequence, sequence.Number());
} }
// clone the data // clone the data
@ -481,8 +481,8 @@ BufferQueue::Dump() const
SegmentList::ConstIterator iterator = fList.GetIterator(); SegmentList::ConstIterator iterator = fList.GetIterator();
int32 number = 0; int32 number = 0;
while (net_buffer* buffer = iterator.Next()) { while (net_buffer* buffer = iterator.Next()) {
kprintf(" %ld. buffer %p, sequence %lu, size %lu\n", ++number, kprintf(" %" B_PRId32 ". buffer %p, sequence %" B_PRIu32 ", size %"
buffer, buffer->sequence, buffer->size); B_PRIu32 "\n", ++number, buffer, buffer->sequence, buffer->size);
} }
} }

View File

@ -2330,45 +2330,50 @@ TCPEndpoint::Dump() const
{ {
kprintf("TCP endpoint %p\n", this); kprintf("TCP endpoint %p\n", this);
kprintf(" state: %s\n", name_for_state(fState)); kprintf(" state: %s\n", name_for_state(fState));
kprintf(" flags: 0x%lx\n", fFlags); kprintf(" flags: 0x%" B_PRIx32 "\n", fFlags);
#if KDEBUG #if KDEBUG
kprintf(" lock: { %p, holder: %ld }\n", &fLock, fLock.holder); kprintf(" lock: { %p, holder: %" B_PRId32 " }\n", &fLock, fLock.holder);
#endif #endif
kprintf(" accept sem: %ld\n", fAcceptSemaphore); kprintf(" accept sem: %" B_PRId32 "\n", fAcceptSemaphore);
kprintf(" options: 0x%lx\n", (uint32)fOptions); kprintf(" options: 0x%" B_PRIx32 "\n", (uint32)fOptions);
kprintf(" send\n"); kprintf(" send\n");
kprintf(" window shift: %u\n", fSendWindowShift); kprintf(" window shift: %u\n", fSendWindowShift);
kprintf(" unacknowledged: %lu\n", fSendUnacknowledged.Number()); kprintf(" unacknowledged: %" B_PRIu32 "\n",
kprintf(" next: %lu\n", fSendNext.Number()); fSendUnacknowledged.Number());
kprintf(" max: %lu\n", fSendMax.Number()); kprintf(" next: %" B_PRIu32 "\n", fSendNext.Number());
kprintf(" urgent offset: %lu\n", fSendUrgentOffset.Number()); kprintf(" max: %" B_PRIu32 "\n", fSendMax.Number());
kprintf(" window: %lu\n", fSendWindow); kprintf(" urgent offset: %" B_PRIu32 "\n", fSendUrgentOffset.Number());
kprintf(" max window: %lu\n", fSendMaxWindow); kprintf(" window: %" B_PRIu32 "\n", fSendWindow);
kprintf(" max segment size: %lu\n", fSendMaxSegmentSize); kprintf(" max window: %" B_PRIu32 "\n", fSendMaxWindow);
kprintf(" max segment size: %" B_PRIu32 "\n", fSendMaxSegmentSize);
kprintf(" queue: %lu / %lu\n", fSendQueue.Used(), fSendQueue.Size()); kprintf(" queue: %lu / %lu\n", fSendQueue.Used(), fSendQueue.Size());
#if DEBUG_BUFFER_QUEUE #if DEBUG_BUFFER_QUEUE
fSendQueue.Dump(); fSendQueue.Dump();
#endif #endif
kprintf(" last acknowledge sent: %lu\n", fLastAcknowledgeSent.Number()); kprintf(" last acknowledge sent: %" B_PRIu32 "\n",
kprintf(" initial sequence: %lu\n", fInitialSendSequence.Number()); fLastAcknowledgeSent.Number());
kprintf(" initial sequence: %" B_PRIu32 "\n",
fInitialSendSequence.Number());
kprintf(" receive\n"); kprintf(" receive\n");
kprintf(" window shift: %u\n", fReceiveWindowShift); kprintf(" window shift: %u\n", fReceiveWindowShift);
kprintf(" next: %lu\n", fReceiveNext.Number()); kprintf(" next: %" B_PRIu32 "\n", fReceiveNext.Number());
kprintf(" max advertised: %lu\n", fReceiveMaxAdvertised.Number()); kprintf(" max advertised: %" B_PRIu32 "\n",
kprintf(" window: %lu\n", fReceiveWindow); fReceiveMaxAdvertised.Number());
kprintf(" max segment size: %lu\n", fReceiveMaxSegmentSize); kprintf(" window: %" B_PRIu32 "\n", fReceiveWindow);
kprintf(" max segment size: %" B_PRIu32 "\n", fReceiveMaxSegmentSize);
kprintf(" queue: %lu / %lu\n", fReceiveQueue.Available(), kprintf(" queue: %lu / %lu\n", fReceiveQueue.Available(),
fReceiveQueue.Size()); fReceiveQueue.Size());
#if DEBUG_BUFFER_QUEUE #if DEBUG_BUFFER_QUEUE
fReceiveQueue.Dump(); fReceiveQueue.Dump();
#endif #endif
kprintf(" initial sequence: %lu\n", fInitialReceiveSequence.Number()); kprintf(" initial sequence: %" B_PRIu32 "\n",
kprintf(" duplicate acknowledge count: %lu\n", fInitialReceiveSequence.Number());
kprintf(" duplicate acknowledge count: %" B_PRIu32 "\n",
fDuplicateAcknowledgeCount); fDuplicateAcknowledgeCount);
kprintf(" round trip time: %ld (deviation %ld)\n", fRoundTripTime, kprintf(" round trip time: %" B_PRId32 " (deviation %" B_PRId32 ")\n",
fRoundTripDeviation); fRoundTripTime, fRoundTripDeviation);
kprintf(" retransmit timeout: %lld\n", fRetransmitTimeout); kprintf(" retransmit timeout: %" B_PRId64 "\n", fRetransmitTimeout);
kprintf(" congestion window: %lu\n", fCongestionWindow); kprintf(" congestion window: %" B_PRIu32 "\n", fCongestionWindow);
kprintf(" slow start threshold: %lu\n", fSlowStartThreshold); kprintf(" slow start threshold: %" B_PRIu32 "\n", fSlowStartThreshold);
} }

View File

@ -739,7 +739,7 @@ UdpEndpointManager::ReceiveError(status_t error, net_buffer* buffer)
// original packet // original packet
udp_header header; udp_header header;
if (gBufferModule->read(buffer, 0, &header, if (gBufferModule->read(buffer, 0, &header,
std::min(buffer->size, sizeof(udp_header))) != B_OK) std::min((size_t)buffer->size, sizeof(udp_header))) != B_OK)
return B_BAD_VALUE; return B_BAD_VALUE;
net_domain* domain = buffer->interface_address->domain; net_domain* domain = buffer->interface_address->domain;

View File

@ -30,9 +30,11 @@ UnixAddress::ToString(char *buffer, size_t bufferSize) const
if (!IsValid()) if (!IsValid())
strlcpy(buffer, "<empty>", bufferSize); strlcpy(buffer, "<empty>", bufferSize);
else if (IsInternalAddress()) else if (IsInternalAddress())
snprintf(buffer, bufferSize, "<%05lx>", fInternalID); snprintf(buffer, bufferSize, "<%05" B_PRIx32 ">", fInternalID);
else else {
snprintf(buffer, bufferSize, "<%ld, %lld>", fVolumeID, fNodeID); snprintf(buffer, bufferSize, "<%" B_PRIdDEV ", %" B_PRIdINO ">",
fVolumeID, fNodeID);
}
return buffer; return buffer;
} }

View File

@ -182,7 +182,7 @@ UnixEndpoint::Bind(const struct sockaddr *_address)
sockaddr_un* outAddress = (sockaddr_un*)&socket->address; sockaddr_un* outAddress = (sockaddr_un*)&socket->address;
outAddress->sun_path[0] = '\0'; outAddress->sun_path[0] = '\0';
sprintf(outAddress->sun_path + 1, "%05lx", internalID); sprintf(outAddress->sun_path + 1, "%05" B_PRIx32, internalID);
outAddress->sun_len = INTERNAL_UNIX_ADDRESS_LEN; outAddress->sun_len = INTERNAL_UNIX_ADDRESS_LEN;
// null-byte + 5 hex digits // null-byte + 5 hex digits

View File

@ -399,7 +399,7 @@ size_t
UnixFifo::Readable() const UnixFifo::Readable() const
{ {
size_t readable = fBuffer.Readable(); size_t readable = fBuffer.Readable();
return readable > fReadRequested ? readable - fReadRequested : 0; return (off_t)readable > fReadRequested ? readable - fReadRequested : 0;
} }
@ -407,7 +407,7 @@ size_t
UnixFifo::Writable() const UnixFifo::Writable() const
{ {
size_t writable = fBuffer.Writable(); size_t writable = fBuffer.Writable();
return writable > fWriteRequested ? writable - fWriteRequested : 0; return (off_t)writable > fWriteRequested ? writable - fWriteRequested : 0;
} }

View File

@ -241,12 +241,12 @@ dump_device_interface(int argc, char** argv)
= (net_device_interface*)parse_expression(argv[1]); = (net_device_interface*)parse_expression(argv[1]);
kprintf("device: %p\n", interface->device); kprintf("device: %p\n", interface->device);
kprintf("reader_thread: %ld\n", interface->reader_thread); kprintf("reader_thread: %" B_PRId32 "\n", interface->reader_thread);
kprintf("up_count: %" B_PRIu32 "\n", interface->up_count); kprintf("up_count: %" B_PRIu32 "\n", interface->up_count);
kprintf("ref_count: %" B_PRId32 "\n", interface->ref_count); kprintf("ref_count: %" B_PRId32 "\n", interface->ref_count);
kprintf("deframe_func: %p\n", interface->deframe_func); kprintf("deframe_func: %p\n", interface->deframe_func);
kprintf("deframe_ref_count: %" B_PRId32 "\n", interface->ref_count); kprintf("deframe_ref_count: %" B_PRId32 "\n", interface->ref_count);
kprintf("consumer_thread: %ld\n", interface->consumer_thread); kprintf("consumer_thread: %" B_PRId32 "\n", interface->consumer_thread);
kprintf("monitor_count: %" B_PRId32 "\n", interface->monitor_count); kprintf("monitor_count: %" B_PRId32 "\n", interface->monitor_count);
kprintf("monitor_lock: %p\n", &interface->monitor_lock); kprintf("monitor_lock: %p\n", &interface->monitor_lock);

View File

@ -77,8 +77,8 @@ dump_domains(int argc, char** argv)
RouteList::Iterator routeIterator = domain->routes.GetIterator(); RouteList::Iterator routeIterator = domain->routes.GetIterator();
while (net_route_private* route = routeIterator.Next()) { while (net_route_private* route = routeIterator.Next()) {
kprintf(" %p: dest %s, mask %s, gw %s, flags %lx, address %p\n", kprintf(" %p: dest %s, mask %s, gw %s, flags %" B_PRIx32 ", "
route, AddressString(domain, route->destination "address %p\n", route, AddressString(domain, route->destination
? route->destination : NULL).Data(), ? route->destination : NULL).Data(),
AddressString(domain, route->mask ? route->mask : NULL).Data(), AddressString(domain, route->mask ? route->mask : NULL).Data(),
AddressString(domain, route->gateway AddressString(domain, route->gateway

View File

@ -148,7 +148,7 @@ dump_local(int argc, char** argv)
size_t i = 0; size_t i = 0;
while (InterfaceAddress* address = iterator.Next()) { while (InterfaceAddress* address = iterator.Next()) {
address->Dump(++i); address->Dump(++i);
dprintf(" hash: %lu\n", dprintf(" hash: %" B_PRIu32 "\n",
address->domain->address_module->hash_address(address->local, address->domain->address_module->hash_address(address->local,
false)); false));
} }

View File

@ -610,7 +610,7 @@ dump_buffer(net_buffer* _buffer)
net_buffer_private* buffer = (net_buffer_private*)_buffer; net_buffer_private* buffer = (net_buffer_private*)_buffer;
dprintf("buffer %p, size %" B_PRIu32 ", flags %" B_PRIx32 ", stored header " dprintf("buffer %p, size %" B_PRIu32 ", flags %" B_PRIx32 ", stored header "
"%" B_PRIu32 ", interface address %p\n", buffer, buffer->size, "%" B_PRIuSIZE ", interface address %p\n", buffer, buffer->size,
buffer->flags, buffer->stored_header_length, buffer->interface_address); buffer->flags, buffer->stored_header_length, buffer->interface_address);
dump_address("source", buffer->source, buffer->interface_address); dump_address("source", buffer->source, buffer->interface_address);
@ -652,11 +652,11 @@ dump_net_buffer(int argc, char** argv)
static int static int
dump_net_buffer_stats(int argc, char** argv) dump_net_buffer_stats(int argc, char** argv)
{ {
kprintf("allocated data headers: %7ld / %7ld, peak %7ld\n", kprintf("allocated data headers: %7" B_PRId32 " / %7" B_PRId32 ", peak %7"
sAllocatedDataHeaderCount, sEverAllocatedDataHeaderCount, B_PRId32 "\n", sAllocatedDataHeaderCount, sEverAllocatedDataHeaderCount,
sMaxAllocatedDataHeaderCount); sMaxAllocatedDataHeaderCount);
kprintf("allocated net buffers: %7ld / %7ld, peak %7ld\n", kprintf("allocated net buffers: %7" B_PRId32 " / %7" B_PRId32 ", peak %7"
sAllocatedNetBufferCount, sEverAllocatedNetBufferCount, B_PRId32 "\n", sAllocatedNetBufferCount, sEverAllocatedNetBufferCount,
sMaxAllocatedNetBufferCount); sMaxAllocatedNetBufferCount);
return 0; return 0;
} }

View File

@ -341,7 +341,7 @@ static void
print_socket_line(net_socket_private* socket, const char* prefix) print_socket_line(net_socket_private* socket, const char* prefix)
{ {
BReference<net_socket_private> parent = socket->parent.GetReference(); BReference<net_socket_private> parent = socket->parent.GetReference();
kprintf("%s%p %2d.%2d.%2d %6ld %p %p %p%s\n", prefix, socket, kprintf("%s%p %2d.%2d.%2d %6" B_PRId32 " %p %p %p%s\n", prefix, socket,
socket->family, socket->type, socket->protocol, socket->owner, socket->family, socket->type, socket->protocol, socket->owner,
socket->first_protocol, socket->first_info, parent.Get(), socket->first_protocol, socket->first_info, parent.Get(),
parent.Get() != NULL ? socket->is_connected ? " (c)" : " (p)" : ""); parent.Get() != NULL ? socket->is_connected ? " (c)" : " (p)" : "");
@ -368,10 +368,10 @@ dump_socket(int argc, char** argv)
kprintf(" options: %x\n", socket->options); kprintf(" options: %x\n", socket->options);
kprintf(" linger: %d\n", socket->linger); kprintf(" linger: %d\n", socket->linger);
kprintf(" bound to device: %" B_PRIu32 "\n", socket->bound_to_device); kprintf(" bound to device: %" B_PRIu32 "\n", socket->bound_to_device);
kprintf(" owner: %ld\n", socket->owner); kprintf(" owner: %" B_PRId32 "\n", socket->owner);
kprintf(" max backlog: %ld\n", socket->max_backlog); kprintf(" max backlog: %" B_PRId32 "\n", socket->max_backlog);
kprintf(" is connected: %d\n", socket->is_connected); kprintf(" is connected: %d\n", socket->is_connected);
kprintf(" child_count: %lu\n", socket->child_count); kprintf(" child_count: %" B_PRIu32 "\n", socket->child_count);
if (socket->child_count == 0) if (socket->child_count == 0)
return 0; return 0;

View File

@ -146,7 +146,7 @@ family::Release()
family::Compare(void* _family, const void* _key) family::Compare(void* _family, const void* _key)
{ {
struct family* family = (struct family*)_family; struct family* family = (struct family*)_family;
int key = (int)_key; int key = (addr_t)_key;
if (family->type == key) if (family->type == key)
return 0; return 0;
@ -159,7 +159,7 @@ family::Compare(void* _family, const void* _key)
family::Hash(void* _family, const void* _key, uint32 range) family::Hash(void* _family, const void* _key, uint32 range)
{ {
struct family* family = (struct family*)_family; struct family* family = (struct family*)_family;
int key = (int)_key; int key = (addr_t)_key;
if (family != NULL) if (family != NULL)
return family->type % range; return family->type % range;
@ -171,7 +171,7 @@ family::Hash(void* _family, const void* _key, uint32 range)
/*static*/ struct family* /*static*/ struct family*
family::Lookup(int type) family::Lookup(int type)
{ {
return (struct family*)hash_lookup(sFamilies, (void*)type); return (struct family*)hash_lookup(sFamilies, (void*)(addr_t)type);
} }

View File

@ -312,7 +312,7 @@ Fifo::Dequeue(bool clone)
} }
ssize_t status_t
Fifo::Clear() Fifo::Clear()
{ {
return base_fifo_clear(this); return base_fifo_clear(this);
@ -632,7 +632,7 @@ dump_timer(int argc, char** argv)
if (timer == NULL) if (timer == NULL)
break; break;
kprintf("%p %p %p %Ld\n", timer, timer->hook, timer->data, kprintf("%p %p %p %" B_PRId64 "\n", timer, timer->hook, timer->data,
timer->due > 0 ? timer->due - system_time() : -1); timer->due > 0 ? timer->due - system_time() : -1);
} }

View File

@ -152,7 +152,7 @@ bus_alloc_resource(device_t dev, int type, int *rid, unsigned long start,
return NULL; return NULL;
device_printf(dev, "bus_alloc_resource(%i, [%i], 0x%lx, 0x%lx, 0x%lx," device_printf(dev, "bus_alloc_resource(%i, [%i], 0x%lx, 0x%lx, 0x%lx,"
"0x%lx)\n", type, *rid, start, end, count, flags); "0x%" B_PRIx32 ")\n", type, *rid, start, end, count, flags);
// maybe a local array of resources is enough // maybe a local array of resources is enough
res = (struct resource *)malloc(sizeof(struct resource)); res = (struct resource *)malloc(sizeof(struct resource));

View File

@ -74,9 +74,9 @@ find_own_image()
int32 cookie = 0; int32 cookie = 0;
image_info info; image_info info;
while (get_next_image_info(B_SYSTEM_TEAM, &cookie, &info) == B_OK) { while (get_next_image_info(B_SYSTEM_TEAM, &cookie, &info) == B_OK) {
if (((uint32)info.text <= (uint32)find_own_image if (((addr_t)info.text <= (addr_t)find_own_image
&& (uint32)info.text + (uint32)info.text_size && (addr_t)info.text + (addr_t)info.text_size
> (uint32)find_own_image)) { > (addr_t)find_own_image)) {
// found our own image // found our own image
return info.id; return info.id;
} }
@ -635,8 +635,8 @@ pmap_kextract(vm_offset_t virtualAddress)
physical_entry entry; physical_entry entry;
status_t status = get_memory_map((void *)virtualAddress, 1, &entry, 1); status_t status = get_memory_map((void *)virtualAddress, 1, &entry, 1);
if (status < B_OK) { if (status < B_OK) {
panic("fbsd compat: get_memory_map failed for %p, error %08lx\n", panic("fbsd compat: get_memory_map failed for %p, error %08" B_PRIx32
(void *)virtualAddress, status); "\n", (void *)virtualAddress, status);
} }
return (vm_paddr_t)entry.address; return (vm_paddr_t)entry.address;

View File

@ -7,10 +7,26 @@
#define _FBSD_COMPAT_MACHINE__BUS_H_ #define _FBSD_COMPAT_MACHINE__BUS_H_
#ifdef B_HAIKU_64_BIT
typedef uint64_t bus_addr_t;
typedef uint64_t bus_size_t;
typedef uint64_t bus_space_tag_t;
typedef uint64_t bus_space_handle_t;
#else
typedef uint32_t bus_addr_t; typedef uint32_t bus_addr_t;
typedef uint32_t bus_size_t; typedef uint32_t bus_size_t;
typedef int bus_space_tag_t; typedef int bus_space_tag_t;
typedef unsigned int bus_space_handle_t; typedef unsigned int bus_space_handle_t;
#endif
#endif /* _FBSD_COMPAT_MACHINE__BUS_H_ */ #endif /* _FBSD_COMPAT_MACHINE__BUS_H_ */

View File

@ -120,7 +120,11 @@
#define I386_BUS_SPACE_MEM 1 #define I386_BUS_SPACE_MEM 1
#define BUS_SPACE_MAXADDR_32BIT 0xffffffff #define BUS_SPACE_MAXADDR_32BIT 0xffffffff
#define BUS_SPACE_MAXADDR 0xffffffff #ifdef __x86_64__
# define BUS_SPACE_MAXADDR 0xffffffffffffffffull
#else
# define BUS_SPACE_MAXADDR 0xffffffff
#endif
#define BUS_SPACE_MAXSIZE_32BIT 0xffffffff #define BUS_SPACE_MAXSIZE_32BIT 0xffffffff
#define BUS_SPACE_MAXSIZE 0xffffffff #define BUS_SPACE_MAXSIZE 0xffffffff

View File

@ -10,11 +10,18 @@
#include <KernelExport.h> #include <KernelExport.h>
// TODO at the moment for 32 bit machines only #ifdef B_HAIKU_64_BIT
typedef uint64_t vm_offset_t;
typedef uint64_t vm_paddr_t;
#else
typedef uint32_t vm_offset_t; typedef uint32_t vm_offset_t;
typedef uint32_t vm_paddr_t; typedef uint32_t vm_paddr_t;
#endif
typedef void *pmap_t; typedef void *pmap_t;

View File

@ -41,7 +41,7 @@ compat_open(const char *name, uint32 flags, void **cookie)
return B_ERROR; return B_ERROR;
ifp = gDevices[i]; ifp = gDevices[i];
if_printf(ifp, "compat_open(0x%lx)\n", flags); if_printf(ifp, "compat_open(0x%" B_PRIx32 ")\n", flags);
if (atomic_or(&ifp->open_count, 1)) { if (atomic_or(&ifp->open_count, 1)) {
put_module(NET_STACK_MODULE_NAME); put_module(NET_STACK_MODULE_NAME);

View File

@ -43,7 +43,11 @@ __FBSDID("$FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.74.2.4 2006/10/21 16:
#include <machine/atomic.h> #include <machine/atomic.h>
#include <machine/bus.h> #include <machine/bus.h>
#define MAX_BPAGES 512 #ifdef __x86_64__
# define MAX_BPAGES 8192
#else
# define MAX_BPAGES 512
#endif
/* -hugo */ /* -hugo */
#define malloc(a, b, c) kernel_malloc(a, b, c) #define malloc(a, b, c) kernel_malloc(a, b, c)
@ -60,7 +64,7 @@ struct bounce_zone;
struct bus_dma_tag { struct bus_dma_tag {
bus_dma_tag_t parent; bus_dma_tag_t parent;
bus_size_t alignment; bus_size_t alignment;
bus_size_t boundary; bus_addr_t boundary;
bus_addr_t lowaddr; bus_addr_t lowaddr;
bus_addr_t highaddr; bus_addr_t highaddr;
bus_dma_filter_t *filter; bus_dma_filter_t *filter;
@ -97,7 +101,7 @@ struct bounce_zone {
int total_bounced; int total_bounced;
int total_deferred; int total_deferred;
bus_size_t alignment; bus_size_t alignment;
bus_size_t boundary; bus_addr_t boundary;
bus_addr_t lowaddr; bus_addr_t lowaddr;
char zoneid[8]; char zoneid[8];
char lowaddrid[20]; char lowaddrid[20];

View File

@ -341,7 +341,7 @@ Services::_StopService(struct service& service)
// Shutdown the running server, if any // Shutdown the running server, if any
if (service.process != -1) { if (service.process != -1) {
printf(" Sending SIGTERM to process %ld\n", service.process); printf(" Sending SIGTERM to process %" B_PRId32 "\n", service.process);
kill(-service.process, SIGTERM); kill(-service.process, SIGTERM);
} }