Opened 3 years ago

Last modified 3 years ago

#13037 assigned enhancement

Review B_32_BIT_CONTIGUOUS memory

Reported by: kallisti5 Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/Kernel Version: R1/Development
Keywords: x86_64 Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

I see a few references in the code that B_32_BIT_CONTIGUOUS was a hack. Quite a few drivers use it and the requirements to leverage it aren't well documented... hell there is only one ticket ever opened about it.

kallisti5@eris haiku :) $ grep -R B_32_BIT_CONTIGUOUS
headers/os/kernel/OS.h:#define	B_32_BIT_CONTIGUOUS		6	/* B_CONTIGUOUS, < 4 GB physical address */
src/add-ons/kernel/bus_managers/firewire/util.c:		B_32_BIT_CONTIGUOUS, protection);
src/add-ons/kernel/bus_managers/scsi/emulation.cpp:		total_size, B_32_BIT_CONTIGUOUS, 0, 0, 0, &virtualRestrictions,
src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp:		roundedSize, B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
src/add-ons/kernel/bus_managers/usb/Stack.cpp:		B_32_BIT_CONTIGUOUS, 0);
src/add-ons/kernel/busses/ata/silicon_image_3112/silicon_image_3112.c:		B_ANY_KERNEL_ADDRESS, prdtSize, B_32_BIT_CONTIGUOUS, 0);
src/add-ons/kernel/busses/ide/silicon_image_3112/silicon_image_3112.c:		B_ANY_KERNEL_ADDRESS, prdtSize, B_32_BIT_CONTIGUOUS, 0);
src/add-ons/kernel/busses/scsi/53c8xx/53c8xx.c:			B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
src/add-ons/kernel/busses/scsi/buslogic/buslogic.c:		B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
src/add-ons/kernel/drivers/audio/ac97/auich/util.c:		B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
src/add-ons/kernel/drivers/audio/ac97/auvia/util.c:		B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
src/add-ons/kernel/drivers/audio/ac97/es1370/util.c:		B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
src/add-ons/kernel/drivers/audio/ac97/geode/geode_controller.cpp:		B_ANY_KERNEL_ADDRESS, alloc, B_32_BIT_CONTIGUOUS,
src/add-ons/kernel/drivers/audio/ac97/geode/geode_controller.cpp:		B_32_BIT_CONTIGUOUS, 0);
src/add-ons/kernel/drivers/audio/ac97/ich/util.c:		B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
src/add-ons/kernel/drivers/audio/ac97/ichaudio/lala/util.c:		B_32_BIT_CONTIGUOUS, protection);
src/add-ons/kernel/drivers/audio/ac97/sis7018/Stream.cpp:				B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
src/add-ons/kernel/drivers/audio/echo/util.c:		B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
src/add-ons/kernel/drivers/audio/emuxki/util.c:		B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
src/add-ons/kernel/drivers/dvb/cx23882/util.c:		B_32_BIT_CONTIGUOUS, protection);
src/add-ons/kernel/drivers/graphics/nvidia/driver.c:			B_32_BIT_CONTIGUOUS, /* GPU always needs access */
src/add-ons/kernel/drivers/graphics/nvidia_gpgpu/driver.c:			B_32_BIT_CONTIGUOUS, /* GPU always needs access */
src/add-ons/kernel/drivers/graphics/radeon/PCI_GART.c:		B_32_BIT_CONTIGUOUS,
src/add-ons/kernel/drivers/network/dp83815/driver.c:		B_ANY_KERNEL_ADDRESS, pages * B_PAGE_SIZE, B_32_BIT_CONTIGUOUS,
src/add-ons/kernel/drivers/network/dp83815/util.c:		B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
src/add-ons/kernel/drivers/network/rtl8169/util.c:		B_32_BIT_CONTIGUOUS, protection);
src/add-ons/kernel/drivers/network/wlan/ipw2100/ipw2100.cpp:		size, B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
src/add-ons/kernel/generic/ata_adapter/ata_adapter.cpp:		prdt_size, B_32_BIT_CONTIGUOUS, 0);
src/add-ons/kernel/generic/ide_adapter/ide_adapter.cpp:		prdt_size, B_32_BIT_CONTIGUOUS, 0);
src/kits/debugger/user_interface/util/UiUtils.cpp:		case B_32_BIT_CONTIGUOUS:
src/system/kernel/vm/vm.cpp:		case B_32_BIT_CONTIGUOUS:
src/system/kernel/vm/vm.cpp:			lock = B_32_BIT_CONTIGUOUS;

usb stack:

area_id
Stack::AllocateArea(void **logicalAddress, phys_addr_t *physicalAddress, size_t size,
    const char *name)
{
    TRACE("allocating %ld bytes for %s\n", size, name);

    void *logAddress;
    size = (size + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1);
    area_id area = create_area(name, &logAddress, B_ANY_KERNEL_ADDRESS, size,
        B_32_BIT_CONTIGUOUS, 0);
        // TODO: Use B_CONTIGUOUS when the TODOs regarding 64 bit physical
        // addresses are fixed (if possible).

Change History (1)

comment:1 by axeld, 3 years ago

Owner: changed from axeld to nobody
Status: newassigned
Note: See TracTickets for help on using tickets.