Re: Help on relicensing derived code

2009-07-17 Thread Dag-Erling Smørgrav
Henrique Almeida hda...@gmail.com writes:
 I need to write an errno.h with constant values used by the FreeBSD
 kernel. My project uses exclusively the 2 clause BSD license. I
 expected to copy those values from FreeBSD errno.h. However, FreeBSD
 errno.h has 3 clauses. I'm a total newbie in licensing procedures so,
 it's not clear what to do.

In the US at least, you can safely ignore the license and copy the macro
definitions themselves.  There is plenty of legal precedent (including
but not limited to SCO vs. IBM) to back that up.  I'm unsure about the
comments, though.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Reading acpi memory from a driver attached to hostb

2009-07-17 Thread Andre Albsmeier
[CC'ing this to Rui Paulo since he tried to help me a while ago]

I have written a driver that is a child of hostb (similar to agp) for
RELENG_7. However, on some chipsets (e.g. i975) it has to read some
memory locations (not pci configuration space) which were registered
by acpi as system resources.

Since my driver is a child of hostb0, I have no idea of how to access
this memory area. Here is a devinfo -r to make things clear:

nexus0
  acpi0
  Interrupt request lines:
  9
  I/O ports:
  0x10-0x1f
  0x22-0x3f
  ...
  0x800-0x87f
  I/O memory addresses:
  0xc-0xd
  0xe-0xf
  0xf000-0xf3ff
  0xfec0-0xfec00fff
  0xfed13000-0xfed19fff --- the memory needed
  0xfed1c000-0xfed1
  
  0xfed2-0xfed3
  0xfff0-0x
cpu0
  coretemp0
  acpi_throttle0
  ACPI I/O ports:
  0x810-0x813
  cpufreq0
cpu1
  coretemp1
pcib0
  pci0
  I/O ports:
  0x170-0x177
  0x376
hostb0
I/O memory addresses:
0xe400-0xe7ff
  MYDRIVER0  --- my driver
  agp0
pcib1
  pci7
vgapci0
Interrupt request lines:
16

I had the same problem under RELENG_6 six month ago which could be
solved by a bus_set_resource() but since the driver now attaches to
hostb, this is not possible anymore.

Earlier, I was given the hint to attach as a child of acpi (see the
old mail attached below) but in this case I didn't have access to the
hostb registers which I need as well.

The only thing I see is: Attach two drivers -- one as child of acpi
and another as child of hostb and let them communicate somehow (no
idea how to do this).

I have also done crazy things like searching for acpi0 and trying
to bus_alloc_resource() the memory I am interested in but this also
failed.

Or is it possible to free(!) somehow the address space from acpi0
and pass it to hostb0 so I can bus_alloc_resource() it?

Thanks a lot for all ideas,

-Andre

--

 Hello all,

 I am writing a driver which needs to access memory at a
 specific location. The location depends on what the BIOS
 has configured into the host bridge. For example, my
 current machine uses an Intel 975X chipset and the memory
 location I am interested in has been set to 0xFED14000 and
 is 16KB in size (this is MCHBAR of the 975X memory hub).

You probably just need to do something like:

rid = PCI_BAR(number);
res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, rid, RF_ACTIVE);

And then,
bus_read_4(res, offset from specified PCI BAR);



 I have no idea how to access this space from my driver.
 I have played around with bus_alloc_resource() but this
 only gives me back NULL.

 However, a devinfo -r gives me:

 nexus0
  npx0
  acpi0
  Interrupt request lines:
  9
  I/O ports:
  0x10-0x1f
 ...
  0x800-0x87f
  I/O memory addresses:
  0x0-0x9
  0xc-0xd
  0xe-0xf
  0x10-0x7fff
  0xf000-0xf3ff
  0xfec0-0xfec00fff
  0xfed13000-0xfed19fff---
  0xfed1c000-0xfed1
  0xfed2-0xfed3
  0xfed5-0xfed8
  0xfee0-0xfee00fff
  0xffb0-0xffbf
  0xfff0-0x
cpu0
 ...

 The line marked with --- shows the range which includes
 the location I am interested in. It is probably assigned
 to the acpi0 device.

 How do I proceed from this? Do I have to hack around in
 the ACPI-Code? I don't hope so ;-)

You'll probably need to create a fake ACPI child driver to access it.

Create your identify routine with something like:

static void mydriver_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, mydriver, -1) == NULL 
mydriver_match(parent))
device_add_child(parent, mydriver, -1);
}

mydriver_match() should check if you were given the acpi0 device.


Regards,
--
Rui Paulo
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Reading acpi memory from a driver attached to hostb

2009-07-17 Thread Julian Elischer

Andre Albsmeier wrote:

[CC'ing this to Rui Paulo since he tried to help me a while ago]

I have written a driver that is a child of hostb (similar to agp) for
RELENG_7. However, on some chipsets (e.g. i975) it has to read some
memory locations (not pci configuration space) which were registered
by acpi as system resources.

Since my driver is a child of hostb0, I have no idea of how to access
this memory area. Here is a devinfo -r to make things clear:

nexus0
  acpi0
  Interrupt request lines:
  9
  I/O ports:
  0x10-0x1f
  0x22-0x3f
  ...
  0x800-0x87f
  I/O memory addresses:
  0xc-0xd
  0xe-0xf
  0xf000-0xf3ff
  0xfec0-0xfec00fff
  0xfed13000-0xfed19fff --- the memory needed
  0xfed1c000-0xfed1
  
  0xfed2-0xfed3
  0xfff0-0x
cpu0
  coretemp0
  acpi_throttle0
  ACPI I/O ports:
  0x810-0x813
  cpufreq0
cpu1
  coretemp1
pcib0
  pci0
  I/O ports:
  0x170-0x177
  0x376
hostb0
I/O memory addresses:
0xe400-0xe7ff
  MYDRIVER0  --- my driver
  agp0
pcib1
  pci7
vgapci0
Interrupt request lines:
16

I had the same problem under RELENG_6 six month ago which could be
solved by a bus_set_resource() but since the driver now attaches to
hostb, this is not possible anymore.

Earlier, I was given the hint to attach as a child of acpi (see the
old mail attached below) but in this case I didn't have access to the
hostb registers which I need as well.

The only thing I see is: Attach two drivers -- one as child of acpi
and another as child of hostb and let them communicate somehow (no
idea how to do this).

I have also done crazy things like searching for acpi0 and trying
to bus_alloc_resource() the memory I am interested in but this also
failed.

Or is it possible to free(!) somehow the address space from acpi0
and pass it to hostb0 so I can bus_alloc_resource() it?

Thanks a lot for all ideas,

-Andre



You can probably make two drivers in one which cooperate to
allow access to both sets of resources.





___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org