linux/drivers/char/agp/amd64-agp.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright 2001-2003 SuSE Labs.
 * Distributed under the GNU public license, v2.
 *
 * This is a GART driver for the AMD Opteron/Athlon64 on-CPU northbridge.
 * It also includes support for the AMD 8151 AGP bridge,
 * although it doesn't actually do much, as all the real
 * work is done in the northbridge(s).
 */

#include <linux/module.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/agp_backend.h>
#include <linux/mmzone.h>
#include <asm/page.h>		/* PAGE_SIZE */
#include <asm/e820/api.h>
#include <asm/amd_nb.h>
#include <asm/gart.h>
#include "agp.h"

/* NVIDIA K8 registers */
#define NVIDIA_X86_64_0_APBASE
#define NVIDIA_X86_64_1_APBASE1
#define NVIDIA_X86_64_1_APLIMIT1
#define NVIDIA_X86_64_1_APSIZE
#define NVIDIA_X86_64_1_APBASE2
#define NVIDIA_X86_64_1_APLIMIT2

/* ULi K8 registers */
#define ULI_X86_64_BASE_ADDR
#define ULI_X86_64_HTT_FEA_REG
#define ULI_X86_64_ENU_SCR_REG

static struct resource *aperture_resource;
static bool __initdata agp_try_unsupported =;
static int agp_bridges_found;

static void amd64_tlbflush(struct agp_memory *temp)
{}

static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
{}

/*
 * This hack alters the order element according
 * to the size of a long. It sucks. I totally disown this, even
 * though it does appear to work for the most part.
 */
static struct aper_size_info_32 amd64_aperture_sizes[7] =;


/*
 * Get the current Aperture size from the x86-64.
 * Note, that there may be multiple x86-64's, but we just return
 * the value from the first one we find. The set_size functions
 * keep the rest coherent anyway. Or at least should do.
 */
static int amd64_fetch_size(void)
{}

/*
 * In a multiprocessor x86-64 system, this function gets
 * called once for each CPU.
 */
static u64 amd64_configure(struct pci_dev *hammer, u64 gatt_table)
{}


static const struct aper_size_info_32 amd_8151_sizes[7] =;

static int amd_8151_configure(void)
{}


static void amd64_cleanup(void)
{}


static const struct agp_bridge_driver amd_8151_driver =;

/* Some basic sanity checks for the aperture. */
static int agp_aperture_valid(u64 aper, u32 size)
{}

/*
 * W*s centric BIOS sometimes only set up the aperture in the AGP
 * bridge, not the northbridge. On AMD64 this is handled early
 * in aperture.c, but when IOMMU is not enabled or we run
 * on a 32bit kernel this needs to be redone.
 * Unfortunately it is impossible to fix the aperture here because it's too late
 * to allocate that much memory. But at least error out cleanly instead of
 * crashing.
 */
static int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp, u16 cap)
{}

static int cache_nbs(struct pci_dev *pdev, u32 cap_ptr)
{}

/* Handle AMD 8151 quirks */
static void amd8151_init(struct pci_dev *pdev, struct agp_bridge_data *bridge)
{}


static const struct aper_size_info_32 uli_sizes[7] =;
static int uli_agp_init(struct pci_dev *pdev)
{}


static const struct aper_size_info_32 nforce3_sizes[5] =;

/* Handle shadow device of the Nvidia NForce3 */
/* CHECK-ME original 2.4 version set up some IORRs. Check if that is needed. */
static int nforce3_agp_init(struct pci_dev *pdev)
{}

static int agp_amd64_probe(struct pci_dev *pdev,
			   const struct pci_device_id *ent)
{}

static void agp_amd64_remove(struct pci_dev *pdev)
{}

static int agp_amd64_resume(struct device *dev)
{}

static const struct pci_device_id agp_amd64_pci_table[] =;

MODULE_DEVICE_TABLE(pci, agp_amd64_pci_table);

static const struct pci_device_id agp_amd64_pci_promisc_table[] =;

static DEFINE_SIMPLE_DEV_PM_OPS(agp_amd64_pm_ops, NULL, agp_amd64_resume);

static struct pci_driver agp_amd64_pci_driver =;


/* Not static due to IOMMU code calling it early. */
int __init agp_amd64_init(void)
{}

static int __init agp_amd64_mod_init(void)
{}

static void __exit agp_amd64_cleanup(void)
{}

module_init();
module_exit(agp_amd64_cleanup);

MODULE_AUTHOR();
module_param(agp_try_unsupported, bool, 0);
MODULE_DESCRIPTION();
MODULE_LICENSE();