Converted sources that include the private <vm/vm.h> to C++. Fixes the build.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37081 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-06-10 10:38:29 +00:00
parent d0a2818e88
commit 297bfa1aba
9 changed files with 62 additions and 42 deletions
+3 -3
View File
@@ -21,7 +21,7 @@ local events_src =
evxfregn.c
;
local hardware_src =
local hardware_src =
hwacpi.c
hwgpe.c
hwregs.c
@@ -158,7 +158,7 @@ local utilities_src =
utresrc.c
utstate.c
uttrack.c
utxface.c
utxface.c
;
StaticLibrary libacpi_ca.a :
@@ -184,7 +184,7 @@ SEARCH on [ FGristFiles $(executer_src) ] = [ FDirName $(HAIKU_TOP) src add-ons
SEARCH on [ FGristFiles $(parser_src) ] = [ FDirName $(HAIKU_TOP) src add-ons kernel bus_managers acpi parser ] ;
KernelAddon acpi :
oshaiku.c
oshaiku.cpp
acpi_busman.c
acpi_module.c
acpi_device.c
@@ -114,8 +114,8 @@
*****************************************************************************/
#include <stdio.h>
#include <sys/cdefs.h>
#include <time.h>
#include <unistd.h>
@@ -131,11 +131,13 @@
# include <vm/vm.h>
#endif
__BEGIN_DECLS
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acparser.h"
#include "acdebug.h"
__END_DECLS
ACPI_MODULE_NAME("Haiku ACPI Module")
@@ -318,7 +320,7 @@ void
AcpiOsRedirectOutput(void *destination)
{
DEBUG_FUNCTION();
AcpiGbl_OutputFile = destination;
AcpiGbl_OutputFile = (FILE*)destination;
}
@@ -890,7 +892,7 @@ AcpiOsReadPciConfiguration(ACPI_PCI_ID *pciId, UINT32 reg, void *value,
UINT32 width)
{
uint32 *val;
val = value;
val = (uint32*)value;
#ifdef _KERNEL_MODE
DEBUG_FUNCTION();
@@ -1198,7 +1200,7 @@ AcpiOsSignal(UINT32 function, void *info)
switch (function) {
case ACPI_SIGNAL_FATAL:
#ifdef _KERNEL_MODE
panic(info == NULL ? "AcpiOsSignal: fatal" : info);
panic(info == NULL ? "AcpiOsSignal: fatal" : (const char*)info);
break;
#endif
case ACPI_SIGNAL_BREAKPOINT:
@@ -1234,16 +1236,16 @@ AcpiOsSignal(UINT32 function, void *info)
int
AcpiOsAcquireGlobalLock(uint32 *lock)
{
uint32 new;
uint32 old;
uint32 newValue;
uint32 oldValue;
do {
old = *lock;
new = ((old & ~GL_BIT_MASK) | GL_BIT_OWNED) |
((old >> 1) & GL_BIT_PENDING);
atomic_test_and_set(lock, new, old);
} while (*lock == old);
return ((new < GL_BIT_MASK) ? GL_ACQUIRED : GL_BUSY);
oldValue = *lock;
newValue = ((oldValue & ~GL_BIT_MASK) | GL_BIT_OWNED) |
((oldValue >> 1) & GL_BIT_PENDING);
atomic_test_and_set((int32*)lock, newValue, oldValue);
} while (*lock == oldValue);
return ((newValue < GL_BIT_MASK) ? GL_ACQUIRED : GL_BUSY);
}
@@ -1257,15 +1259,15 @@ AcpiOsAcquireGlobalLock(uint32 *lock)
int
AcpiOsReleaseGlobalLock(uint32 *lock)
{
uint32 new;
uint32 old;
uint32 newValue;
uint32 oldValue;
do {
old = *lock;
new = old & ~GL_BIT_MASK;
atomic_test_and_set(lock, new, old);
} while (*lock == old);
return (old & GL_BIT_PENDING);
oldValue = *lock;
newValue = oldValue & ~GL_BIT_MASK;
atomic_test_and_set((int32*)lock, newValue, oldValue);
} while (*lock == oldValue);
return (oldValue & GL_BIT_PENDING);
}
+2 -2
View File
@@ -14,9 +14,9 @@ KernelAddon scsi :
ccb.c
device_scan.c
devices.c
dma_buffer.c
dma_buffer.cpp
dpc.c
emulation.c
emulation.cpp
queuing.c
scsi.c
scsi_io.c
@@ -12,12 +12,18 @@
#ifndef _KERNEL_EXPORT_EXT_H
#define _KERNEL_EXPORT_EXT_H
#include <sys/cdefs.h>
#include <KernelExport.h>
#include <iovec.h>
__BEGIN_DECLS
// get memory map of iovec
status_t get_iovec_memory_map(
status_t get_iovec_memory_map(
iovec *vec, // iovec to analyze
size_t vec_count, // number of entries in vec
size_t vec_offset, // number of bytes to skip at beginning of vec
@@ -28,4 +34,8 @@ status_t get_iovec_memory_map(
size_t *mapped_len // actual number of bytes described by map
);
__END_DECLS
#endif
@@ -101,12 +101,12 @@ scsi_copy_dma_buffer(scsi_ccb *request, uint32 size, bool to_buffer)
dma_buffer *buffer = request->dma_buffer;
const physical_entry *sg_list = buffer->sg_list_orig;
uint32 num_vecs = buffer->sg_count_orig;
char *buffer_data = buffer->address;
uchar *buffer_data = buffer->address;
SHOW_FLOW(1, "to_buffer=%d, %d bytes", to_buffer, (int)size);
// survive even if controller returned invalid data size
size = min(size, request->data_length);
size = min_c(size, request->data_length);
// we have to use S/G list to original data; the DMA buffer
// was allocated in kernel and is thus visible even if the thread
@@ -114,7 +114,7 @@ scsi_copy_dma_buffer(scsi_ccb *request, uint32 size, bool to_buffer)
for (; size > 0 && num_vecs > 0; ++sg_list, --num_vecs) {
size_t bytes;
bytes = min( size, sg_list->size );
bytes = min_c( size, sg_list->size );
if (to_buffer) {
vm_memcpy_from_physical(buffer_data, sg_list->address, bytes,
@@ -495,7 +495,7 @@ scsi_release_dma_buffer(scsi_ccb *request)
void
scsi_dma_buffer_daemon(void *dev, int counter)
{
scsi_device_info *device = dev;
scsi_device_info *device = (scsi_device_info*)dev;
dma_buffer *buffer;
ACQUIRE_BEN(&device->dma_buffer_lock);
@@ -71,8 +71,8 @@ scsi_init_emulation_buffer(scsi_device_info *device, size_t buffer_size)
// to satisfy alignment, we must allocate a buffer twice its required size
// and find the properly aligned part of it, ouch!
device->buffer_area = create_area("ATAPI buffer", (void *)&unaligned_addr, B_ANY_KERNEL_ADDRESS,
2 * total_size, B_CONTIGUOUS, 0);
device->buffer_area = create_area("ATAPI buffer", (void**)&unaligned_addr,
B_ANY_KERNEL_ADDRESS, 2 * total_size, B_CONTIGUOUS, 0);
if (device->buffer_area < 0) {
SHOW_ERROR( 1, "cannot create DMA buffer (%s)", strerror(device->buffer_area));
@@ -91,10 +91,10 @@ scsi_init_emulation_buffer(scsi_device_info *device, size_t buffer_size)
B_PRIxPHYSADDR ", unaligned_addr = %#" B_PRIxADDR ", aligned_addr = %#"
B_PRIxADDR, unaligned_phys, aligned_phys, unaligned_addr, aligned_addr);
device->buffer = (void *)aligned_addr;
device->buffer = (char*)aligned_addr;
device->buffer_size = buffer_size;
// s/g list is directly after buffer
device->buffer_sg_list = (void *)(aligned_addr + buffer_size);
device->buffer_sg_list = (physical_entry*)(aligned_addr + buffer_size);
device->buffer_sg_list[0].address = aligned_phys;
device->buffer_sg_list[0].size = buffer_size;
device->buffer_sg_count = 1;
@@ -482,14 +482,14 @@ copy_sg_data(scsi_ccb *request, uint offset, uint allocation_length,
return 0;
// remaining bytes we are allowed to copy from/to request
req_size = min(allocation_length, request->data_length) - offset;
req_size = min_c(allocation_length, request->data_length) - offset;
// copy one S/G entry at a time
for (; size > 0 && req_size > 0 && sg_count > 0; ++sg_list, --sg_count) {
size_t bytes;
bytes = min(size, req_size);
bytes = min(bytes, sg_list->size);
bytes = min_c(size, req_size);
bytes = min_c(bytes, sg_list->size);
SHOW_FLOW(0, "buffer = %p, virt_addr = %#" B_PRIxPHYSADDR ", bytes = %"
B_PRIuSIZE ", to_buffer = %d", buffer, sg_list->address + offset,
@@ -7,6 +7,7 @@
//! Internal structures/definitions
#include <sys/cdefs.h>
#include <bus/SCSI.h>
#include <scsi_cmds.h>
@@ -110,7 +111,7 @@ typedef struct scsi_bus_info {
device_node *node; // pnp node of bus
dma_params dma_params; // dma restrictions of controller
struct dma_params dma_params; // dma restrictions of controller
scsi_path_inquiry inquiry_data; // inquiry data as read on init
} scsi_bus_info;
@@ -176,7 +177,7 @@ typedef struct scsi_device_info {
struct mutex dma_buffer_lock; // lock between DMA buffer user and clean-up daemon
sem_id dma_buffer_owner; // to be acquired before using DMA buffer
dma_buffer dma_buffer; // DMA buffer
struct dma_buffer dma_buffer; // DMA buffer
// buffer used for emulating SCSI commands
char *buffer;
@@ -211,7 +212,7 @@ enum {
SCSI_STATE_QUEUED = 2,
SCSI_STATE_SENT = 3,
SCSI_STATE_FINISHED = 5,
} scsi_state;
};
extern locked_pool_interface *locked_pool;
@@ -223,6 +224,8 @@ extern scsi_device_interface scsi_device_module;
extern struct device_module_info gSCSIBusRawModule;
__BEGIN_DECLS
// busses.c
uchar scsi_inquiry_path(scsi_bus bus, scsi_path_inquiry *inquiry_data);
@@ -298,4 +301,8 @@ void scsi_finish_emulation(scsi_ccb *request);
void scsi_free_emulation_buffer(scsi_device_info *device);
status_t scsi_init_emulation_buffer(scsi_device_info *device, size_t buffer_size);
__END_DECLS
#endif /* _SCSI_INTERNAL_H */
+1 -1
View File
@@ -11,5 +11,5 @@ KernelAddon ahci :
ahci_port.cpp
ahci_sim.cpp
sata_request.cpp
util.c
util.cpp
;
@@ -50,7 +50,8 @@ alloc_mem(void **virt, void **phy, size_t size, uint32 protection,
*virt = virtadr;
if (phy)
*phy = (void*)(addr_t)pe.address;
TRACE("area = %ld, size = %ld, virt = %p, phy = %p\n", areaid, size, virtadr, pe.address);
TRACE("area = %ld, size = %ld, virt = %p, phy = %#" B_PRIxPHYSADDR "\n",
areaid, size, virtadr, pe.address);
return areaid;
}
@@ -110,7 +111,7 @@ sg_memcpy(const physical_entry *sgTable, int sgCount, const void *data,
void
swap_words(void *data, size_t size)
{
uint16 *word = data;
uint16 *word = (uint16*)data;
size_t count = size / 2;
while (count--) {
*word = (*word << 8) | (*word >> 8);