From alexs@snark.ratmir.ru  Mon Mar 31 13:11:01 2003
Return-Path: <alexs@snark.ratmir.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 8440737B405
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 31 Mar 2003 13:11:01 -0800 (PST)
Received: from snark.ratmir.ru (snark.ratmir.ru [213.24.248.177])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 35B8243FB1
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 31 Mar 2003 13:11:00 -0800 (PST)
	(envelope-from alexs@snark.ratmir.ru)
Received: from snark.ratmir.ru (alexs@localhost [127.0.0.1])
	by snark.ratmir.ru (8.12.9/8.12.9) with ESMTP id h2VLAwDR057796
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 1 Apr 2003 01:10:58 +0400 (MSD)
	(envelope-from alexs@snark.ratmir.ru)
Received: (from alexs@localhost)
	by snark.ratmir.ru (8.12.9/8.12.9/Submit) id h2VLAwWO057795;
	Tue, 1 Apr 2003 01:10:58 +0400 (MSD)
Message-Id: <200303312110.h2VLAwWO057795@snark.ratmir.ru>
Date: Tue, 1 Apr 2003 01:10:58 +0400 (MSD)
From: Alex Semenyaka <alexs@snark.ratmir.ru>
Reply-To: Alex Semenyaka <alexs@snark.ratmir.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Upgate to the agp(4) manual page
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         50503
>Category:       docs
>Synopsis:       Upgate to the agp(4) manual page
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    hmp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 31 13:20:06 PST 2003
>Closed-Date:    Mon May 12 14:38:44 PDT 2003
>Last-Modified:  Mon May 12 14:38:44 PDT 2003
>Originator:     Alex Semenyaka
>Release:        FreeBSD 4.8-RC i386
>Organization:
Ratmir
>Environment:
System: FreeBSD snark.ratmir.ru 4.8-RC FreeBSD 4.8-RC #7: Sun Mar 30 07:23:48 MSD 2003 root@snark.ratmir.ru:/usr/obj/usr/src/sys/SNARK i386

>Description:

There were no descriptions of agp ioctls. I tried to provide such decriptions
on the base of the source code of AGP systems and (primarily) the comments
there.

>How-To-Repeat:

man 4 agp

>Fix:

Apply the following patch to the agp.4:

--- /usr/src/share/man/man4/agp.4	Wed Feb 26 00:38:48 2003
+++ agp.4	Tue Apr  1 01:07:55 2003
@@ -58,6 +58,99 @@
 is for running
 .Xr XFree86 1
 on the Intel i81x controllers.
+.Sh IOCTLS
+The
+.Pa /dev/agpgart
+can be opened and a few operations can be performed on it. The
+.Xr ioctl 2
+command codes below are defined in
+.Aq Pa sys/agpio.h .
+.Bl -tag -width AGPIOC_DEALLOCATE
+.It Dv AGPIOC_INFO
+.Pq Li "agp_info *"
+Returns the state of AGP system. The result is a pointer to
+the following structure:
+.Bd -literal
+typedef struct _agp_info {
+	agp_version version;	/* version of the driver        */
+	u_int32_t bridge_id;	/* bridge vendor/device         */
+	u_int32_t agp_mode;	/* mode info of bridge          */
+	off_t aper_base;	/* base of aperture             */
+	size_t aper_size;	/* size of aperture             */
+	size_t pg_total;	/* max pages (swap + system)    */
+	size_t pg_system;	/* max pages (system)           */
+	size_t pg_used;		/* current pages used           */
+} agp_info;
+.Ed
+.Pp
+.It Dv AGPIOC_ACQUIRE
+Acquire AGP chipset for use by the kernel. Returns
+.Er EBUSY
+if the AGP chipset is already acquired by another user.
+.It Dv AGPIOC_RELEASE
+Release AGP chipset.
+.It Dv AGPIOC_SETUP
+.Pq Li "agp_setup *"
+Enable the
+.Nm
+hardware with the relevant mode. The argument is the pointer to the
+following type:
+.Bd -literal
+typedef struct _agp_setup {
+	u_int32_t agp_mode;		/* mode info of bridge          */
+} agp_setup;
+.Ed
+.Pp
+The mode bits are defined in
+.Aq Pa sys/agpio.h .
+.It Dv AGPIOC_ALLOCATE
+.Pq Li "agp_allocate *"
+Allocate physical memory suitable for mapping into the AGP aperture.
+The third argument is the pointer to the following structure:
+.Bd -literal
+typedef struct _agp_allocate {
+	int key;		/* tag of allocation            */
+	size_t pg_count;	/* number of pages              */
+	u_int32_t type;		/* 0 == normal, other devspec   */
+   	u_int32_t physical;     /* device specific (some devices  
+				 * need a phys address of the     
+				 * actual page behind the gatt    
+				 * table)                        */
+} agp_allocate;
+.Ed
+.Pp
+Returns the handle to the memory allocated.
+.It Dv AGPIOC_DEALLOCATE
+.Pq Li "int *"
+Free the previously allocated memory associated with the handle passed.
+.It Dv AGPIOC_BIND
+.Pq Li "agp_bind *"
+Bind the allocated memory at given offset with the AGP aperture. Returns
+.Er EINVAL
+if the memory is already bound or the offset is not at an AGP page boundary.
+The third argument is the pointer to the following structure:
+.Bd -literal
+typedef struct _agp_bind {
+	int key;		/* tag of allocation            */
+	off_t pg_start;		/* starting page to populate    */
+} agp_bind;
+.Ed
+.Pp
+The tag of allocation here means the handle returned by AGPIOC_ALLOCATE.
+.It Dv AGPIOC_UNBIND
+.Pq Li "agp_unbind *"
+Unbind memory from the AGP aperture. Return
+.Er EINVAL
+if the memory is not bound. The third argument is the pointer to the
+following structure:
+.Bd -literal
+typedef struct _agp_unbind {
+	int key;		/* tag of allocation            */
+	u_int32_t priority;	/* priority for paging out      */
+} agp_unbind;
+.Ed
+.Pp
+.El
 .Sh FILES
 .Bl -tag -width ".Pa /dev/agpgart" -compact
 .It Pa /dev/agpgart
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-doc->hmp 
Responsible-Changed-By: hmp 
Responsible-Changed-When: Sat May 10 01:08:49 PDT 2003 
Responsible-Changed-Why:  
With input from Eric Anholt <anholt@FreeBSD.ORG>, 
I feel safe to take responsibility for this PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50503 
State-Changed-From-To: open->closed 
State-Changed-By: hmp 
State-Changed-When: Mon May 12 14:36:42 PDT 2003 
State-Changed-Why:  
Thanks!  A derivitive patch has been committed. 
No plans for MFC'ing to RELENG_4 are made, yet. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50503 
>Unformatted:
