Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50eca3eb authored by Bob Moore's avatar Bob Moore Committed by Len Brown
Browse files

[ACPI] ACPICA 20050930



Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)

All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".

The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available.  Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)

Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.

acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().

Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 3d5271f9
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -33,33 +33,33 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
	struct acpi_vendor_info *info = (struct acpi_vendor_info *)context;
	struct acpi_resource_vendor *vendor;
	struct acpi_vendor_descriptor *descriptor;
	u32 length;
	u32 byte_length;

	if (resource->type != ACPI_RSTYPE_VENDOR)
	if (resource->type != ACPI_RESOURCE_TYPE_VENDOR)
		return AE_OK;

	vendor = (struct acpi_resource_vendor *)&resource->data;
	descriptor = (struct acpi_vendor_descriptor *)vendor->reserved;
	if (vendor->length <= sizeof(*info->descriptor) ||
	descriptor = (struct acpi_vendor_descriptor *)vendor->byte_data;
	if (vendor->byte_length <= sizeof(*info->descriptor) ||
	    descriptor->guid_id != info->descriptor->guid_id ||
	    efi_guidcmp(descriptor->guid, info->descriptor->guid))
		return AE_OK;

	length = vendor->length - sizeof(struct acpi_vendor_descriptor);
	info->data = acpi_os_allocate(length);
	byte_length = vendor->byte_length - sizeof(struct acpi_vendor_descriptor);
	info->data = acpi_os_allocate(byte_length);
	if (!info->data)
		return AE_NO_MEMORY;

	memcpy(info->data,
	       vendor->reserved + sizeof(struct acpi_vendor_descriptor),
	       length);
	info->length = length;
	       vendor->byte_data + sizeof(struct acpi_vendor_descriptor),
	       byte_length);
	info->length = byte_length;
	return AE_CTRL_TERMINATE;
}

acpi_status
acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
			  u8 ** data, u32 * length)
			  u8 ** data, u32 * byte_length)
{
	struct acpi_vendor_info info;

@@ -72,7 +72,7 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
		return AE_NOT_FOUND;

	*data = info.data;
	*length = info.length;
	*byte_length = info.length;
	return AE_OK;
}

+4 −4
Original line number Diff line number Diff line
@@ -193,12 +193,12 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr)
		goto free_resource;
	}

	min = addr->min_address_range;
	min = addr->minimum;
	max = min + addr->address_length - 1;
	if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION)
		sparse = 1;

	space_nr = new_space(addr->address_translation_offset, sparse);
	space_nr = new_space(addr->translation_offset, sparse);
	if (space_nr == ~0)
		goto free_name;

@@ -285,7 +285,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
	if (addr.resource_type == ACPI_MEMORY_RANGE) {
		flags = IORESOURCE_MEM;
		root = &iomem_resource;
		offset = addr.address_translation_offset;
		offset = addr.translation_offset;
	} else if (addr.resource_type == ACPI_IO_RANGE) {
		flags = IORESOURCE_IO;
		root = &ioport_resource;
@@ -298,7 +298,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
	window = &info->controller->window[info->controller->windows++];
	window->resource.name = info->name;
	window->resource.flags = flags;
	window->resource.start = addr.min_address_range + offset;
	window->resource.start = addr.minimum + offset;
	window->resource.end = window->resource.start + addr.address_length - 1;
	window->resource.child = NULL;
	window->offset = offset;
+5 −5
Original line number Diff line number Diff line
@@ -1956,7 +1956,7 @@ int __init io_apic_get_redir_entries (int ioapic)
}


int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low)
int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity)
{
	struct IO_APIC_route_entry entry;
	unsigned long flags;
@@ -1978,8 +1978,8 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
	entry.delivery_mode = INT_DELIVERY_MODE;
	entry.dest_mode = INT_DEST_MODE;
	entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
	entry.trigger = edge_level;
	entry.polarity = active_high_low;
	entry.trigger = triggering;
	entry.polarity = polarity;
	entry.mask = 1;					 /* Disabled (masked) */

	irq = gsi_irq_sharing(irq);
@@ -1994,9 +1994,9 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
	apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> "
		"IRQ %d Mode:%i Active:%i)\n", ioapic, 
	       mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq,
	       edge_level, active_high_low);
	       triggering, polarity);

	ioapic_register_intr(irq, entry.vector, edge_level);
	ioapic_register_intr(irq, entry.vector, triggering);

	if (!ioapic && (irq < 16))
		disable_8259A_irq(irq);
+4 −4
Original line number Diff line number Diff line
@@ -915,7 +915,7 @@ void __init mp_config_acpi_legacy_irqs (void)

#define MAX_GSI_NUM	4096

int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
int mp_register_gsi(u32 gsi, int triggering, int polarity)
{
	int			ioapic = -1;
	int			ioapic_pin = 0;
@@ -964,7 +964,7 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)

	mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit);

	if (edge_level) {
	if (triggering) {
		/*
		 * For PCI devices assign IRQs in order, avoiding gaps
		 * due to unused I/O APIC pins.
@@ -986,8 +986,8 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
	}

	io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
		edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1,
		active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1);
		triggering == ACPI_EDGE_SENSITIVE ? 0 : 1,
		polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
	return gsi;
}

+2 −2
Original line number Diff line number Diff line
@@ -101,8 +101,8 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
			    address64.attribute.memory.cache_attribute;
			mem_device->read_write_attribute =
			    address64.attribute.memory.read_write_attribute;
			mem_device->start_addr = address64.min_address_range;
			mem_device->end_addr = address64.max_address_range;
			mem_device->start_addr = address64.minimum;
			mem_device->end_addr = address64.maximum;
		}
	}

Loading